Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(MatDialog): MatDialog causes Memory Leak with <button> element #24881

Open
1 task
kraph opened this issue May 5, 2022 · 2 comments
Open
1 task

bug(MatDialog): MatDialog causes Memory Leak with <button> element #24881

kraph opened this issue May 5, 2022 · 2 comments
Labels
area: material/dialog P4 A relatively minor issue that is not relevant to core functions

Comments

@kraph
Copy link

kraph commented May 5, 2022

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When using MatDialog with button and also some material elements, the dialog never gets removed by garbage collector. There still is a reference by Angular (or maybe zone.js) which is never freed. I believe this the same issue like #10188 and angular/angular#25744
It says the problem was fixed in 9.0.0-rc.7 but the problem still exists. I tested this in version 9.1.15, 10.0.14, 13.3.5 and also an older version (6.0.3).

Reproduction

Steps to reproduce:

  1. Create new angular project
  2. Create dialog component (like this: https://material.angular.io/components/dialog/overview)
  3. put a element in the dialog-component.html
  4. compile
  5. open dev tools -> memory
  6. open and close the dialog multiple times, use the garbage collctor afterwards
  7. in edge browser you can also inspect the detached dom nodes under dev toosls -> detached nodes

Expected Behavior

The DOM nodes should be the same before and after opening/closing the button, or at least not go up after the first opening/closing.

Actual Behavior

DOM nodes afterwards are much more than before.

Environment

  • Angular: 13.3.5
  • CDK/Material: 13.3.5
  • Browser(s): Google Chrome(Version 100.0.4896.127), Microsoft Edge(Version 99.0.1150.39)
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 10 (Version 19044.1645)
@kraph kraph added the needs triage This issue needs to be triaged by the team label May 5, 2022
@kraph
Copy link
Author

kraph commented May 6, 2022

Apparantly this problem only occurs when I use the device toolbar in the developers tools

@zarend zarend added P4 A relatively minor issue that is not relevant to core functions area: material/dialog and removed needs triage This issue needs to be triaged by the team labels May 6, 2022
@zarend
Copy link
Contributor

zarend commented May 6, 2022

Hmm, I reproduce in Chrome only if the device toolbar is open too.

Here is what I found without the device toolbar.

Screen Shot 2022-05-06 at 9 50 47 AM

![Uploading Screen Shot 2022-05-06 at 9.49.18 AM.png…]()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: material/dialog P4 A relatively minor issue that is not relevant to core functions
2 participants