Skip to content

Tooltip memory leak with Angular router #14247

@jo-me

Description

@jo-me

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Components are cleaned up after they are destroyed

What is the current behavior?

Components remain in memory IF a tooltip on these components has been triggered.

The behavior could be tied to situations where the angular router is involved. The components & data of a route remain in memory after switching to a different route - again, only if a tooltip has been triggered.
The workaround in related issue (removing HammerJS references) did not work in my situation. Leak was still present.

What are the steps to reproduce?

https://stackblitz.com/edit/angular-material-tooltip-memleak

When you switch tabs back and forth between Login and Home tab, you will notice that the HomeComponent will not show up in a heap dump (when you're currently on the Login tab).
However, if you trigger the tooltip on the Home tab and then go back to Login, the HomeComponent will still be on the heap along with everything it references (e.g. data)

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

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

Originally in Angular 6.1 / Material 6.4.7 but it is still present in the stackblitz above which is baed on
Angular 7.0.4 and Material 7.0.4

Is there anything else we should know?

Lots of similar issues related to tooltip memory leaks:
#8989
#4499
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions