Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Potential Memory Leak With Inactive md-tab #1986

@nkoterba

Description

@nkoterba

In relation to #1982, I'm including code in my directives' controllers that prints out when controllers are destroyed.

For example:

       $scope.$on('$destroy', function () {
        $log.debug('Destroying: file-grid-ctrl');

        // Add any cleanup/tear-down logic here
    });

Based on my exploration of the code and the documentation, internal non-active tab content is removed from the $scope\$digest cycle:

https://material.angularjs.org/#/api/material.components.tabs/directive/mdTabs:

As a performance bonus, if the tab content is managed internally then the non-active (non-visible) tab
contents are temporarily disconnected from the $scope.$digest() processes; which restricts and optimizes
DOM updates to only the currently active tab.

Since Material Design detaches inactive Tab content from the $scope/$digest cycle, none of my controllers for all my "inactive" tabs print out Destorying: file-grid-ctrl. This leads me to believe that any resources or other things I may be "destroying/tearing down/disposing" of in my $destroy callback are not being called, leading to potential memory issues.

Perhaps instead when tabs are removed or destroyed, they should be "re-connected" to the $scope/$digest cycle right before destruction?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions