material icon indicating copy to clipboard operation
material copied to clipboard

memory leak when destroying an angular-material app

Open jaa1982 opened this issue 7 years ago • 3 comments

Actual Behavior:

  • angular-material does not clean-up when angularjs app is destroyed

CodePen (or steps to reproduce the issue): *

  • https://jsfiddle.net/leogdsl/bhkat99u/
  • Details: 3 variations for destroying the app are included in the fiddle, and all show the same behavior. You can quickly modify the fiddle to demonstrate that none have the expected effect

To reproduce, while profiling with dev tools, create and destroy the app multiple times using any of the methods included. Results of tests are all as shown below.

angular-material-memory-leak

AngularJS Versions: *

  • AngularJS Version: 1.5.11
  • AngularJS Material Version: 1.1.5 (latest)

Additional Information:

  • Browser Type: * Chrome, IE
  • Browser Version: * Results shown in Chrome 63
  • OS: * Win10
  • Stack Traces:

Shortcut to create a new CodePen Demo. Note: * indicates required information. Without this information, your issue may be auto-closed.

Do not modify the titles or questions. Simply add your responses to the ends of the questions. Add more lines if needed.

jaa1982 avatar Dec 20 '17 12:12 jaa1982

What is the use case for destroying and re-creating an AngularJS Material app without a page reload? Is this related to ngUpgrade?

Splaktar avatar Dec 27 '17 10:12 Splaktar

We do have some memory leaks in input and dialog:

  • https://github.com/angular/material/issues/10851
  • https://github.com/angular/material/issues/11207

But your demo seems to only be using md-button. It injects $mdDialog but doesn't use it.

I've converted the JSFiddle to a CodePen for easier debugging.

Splaktar avatar Oct 04 '18 18:10 Splaktar

Here's the heaptimeline from my testng in incognito mode: AngularJS-1.7.4-AngularJS-Material-1.1.10-HEAD.heaptimeline.zip

Splaktar avatar Oct 04 '18 18:10 Splaktar