question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dialog causes memory leak when dialog component contains a <button>

See original GitHub issue

Bug, feature request, or proposal:

Instantiating a dialog with a component that contains a regular HTML <button> element causes a DOM node memory leak.

What is the expected behavior?

No memory leak

What is the current behavior?

Memory leak

What are the steps to reproduce?

https://stackblitz.com/edit/angular-material2-issue-dhmjle?file=app/app.module.ts

  1. Open Chrome performance monitor
  2. Click Memory > Garbage collect
  3. Note the initial DOM node count (around 53)
  4. Click the “No leaks on div” button a few times and watch the DOM node count climb
  5. Close any open dialogs and press the “Garbage collect” button again
  6. Watch the DOM node count decrease to around the initial value (plus some “sticky” dialog nodes that intentionally stick around)
  7. Click the “Leaks on button” button a few times and watch the DOM node count climb
  8. Close any open dialogs and press the “Garbage collect” button
  9. Note that the DOM node count does not decrease to the initial value

memleak

What is the use-case or motivation for changing an existing behavior?

Performance

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Latest StackBlitz (Material 5.1.0, Angular 5.2.1), Windows 10, Chrome v64.0.3282.186 64-bit

Is there anything else we should know?

Could be related to https://github.com/angular/angular/issues/20228

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
crisbetocommented, Dec 16, 2019
1reaction
letrimcommented, Jul 17, 2018

Exact same behavion on Angular 6

Read more comments on GitHub >

github_iconTop Results From Across the Web

React memory leaks warning with using a stateful button in a ...
This is the memory leaks warning I get when I click a button inside either an Alert or Dialog component: index.js:1437 Warning: Can't...
Read more >
Memory Leak after disposing a dialog? - Telerik
The problem is that every time that I call ShowDialog after the Form is disposed for first time the memory increases like 5-10...
Read more >
Managing dialogs (multiple screens) - Embedded Wizard
The application contains three embedded Dialog components. All components are configured as invisible. In the bottom area you see three buttons.
Read more >
DialogFragment - Android Developers
This fragment contains a Dialog object, which it displays as appropriate based on the fragment's state. Control of the dialog (deciding when to...
Read more >
Everything you need to know about Memory Leaks in Android.
One of the core benefits of Java, or to be more accurate, of the JVM (Java Virtual Machine), is the garbage collector (GC)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found