Jack Rothrock
Jack Rothrock

Reputation: 427

Angular2 Memory Leaks - Dom Nodes

As show in the picture, the Nodes keep increasing. I have a lot of ngFor loops, that I currently am not using the async pipe on - would this be the root cause?

ngOnDestroy are firing when switching.

enter image description here

enter image description here

Upvotes: 2

Views: 3723

Answers (1)

Mark Acosta
Mark Acosta

Reputation: 330

Well, any lifecycle hook will cause the observable tree to recalculate. Are you using parameters for your route by chance? onDestroy is specifically used when you leave that component entirely, not rerender data. If you are using components inline, then every single time that component rerenders you will be calling its OnDestroy hook. If you can provide code, maybe I can assist you further unless that helps spark something.

Upvotes: 3

Related Questions