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

MdTooltip leaking dom nodes when used in element inside *ngIf #5399

Closed
diginikkari opened this issue Jun 28, 2017 · 3 comments
Closed

MdTooltip leaking dom nodes when used in element inside *ngIf #5399

diginikkari opened this issue Jun 28, 2017 · 3 comments

Comments

@diginikkari
Copy link

Bug, feature request, or proposal:

Bug: MdTooltip is leaking dom nodes when used inside *ngIf

What is the expected behavior?

When parent element is destroyed by *ngIf, it's child nodes should be released and collected by garbage collection.

What is the current behavior?

None of the nodes inside element containing *ngIf are cleared from memory when there is element with MdTooltip -directive.

What are the steps to reproduce?

  • Open chrome devtools and take heap -snapshot.
  • Toggle tooltip item visible ten times.
  • Press garbage collection
  • Take a new heap -snapshot
  • Compare with latest snapshot
  • There are 10 new MdTooltip and 10 text nodes created and 0 deleted. So delta is +10.
<button (click)="showTooltip = !showTooltip">Toggle tooltip</button>
<br>
<div *ngIf="showTooltip">
  <span mdTooltip="Tooltip!">Show tooltip</span>
  <p>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</p>
</div>

Example plunker:
https://plnkr.co/edit/6ayP5LKlM62GUwCpP6Fg?p=preview

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

Save memory

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

Angular 4.2.3
Material 2.0.0-beta.7

Is there anything else we should know?

I'm not too familiar regarding memory management so correct me if I'm misunderstanding how this should work.

@willshowell
Copy link
Contributor

Sounds similar to #4499. Does that look like what you're experiencing?

@diginikkari
Copy link
Author

Yes, it's looks exactly same. Don't know why I didn't find that issue.

I also tested without hammerjs and there were no leak. So it seems to be related to that.

dupe #4499

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants