dialog: generating detached DOM nodes when closed #11207
Description
Bug, feature request, or proposal:
Bug
What is the expected behavior?
Using $mdDialog with custom template should not result in detached DOM nodes.
What is the current behavior?
When using $mdDialog and after closing it via $mdDialog.hide(), the heap snapshots show lot of detached DOM nodes which point to instanceCache
in $mdDialog service. Check out the heap snapshot screenshot
I tried to figure out the internals and i think mdDialog is setting up some kind of internal cache which re-uses things when same modal's are opened multiple times but i failed to identify it concretely and clear those detached nodes from memory. I target to run my application on raspberry pi and it has quite a few modals hence increasing detached dom node count is warning signal for me leading to memory exhaustion over time. Hence i guess i need someone to familiar with internals to point me in right direction and if at all there is something leaking with mdDialog ?
CodePen and steps to reproduce the issue:
CodePen Demo which shows your issue:
I will try to reproduce this issue on codepen but as of now i don't have a pen.
Detailed Reproduction Steps:
I am using ui router and while switching between states if i open a modal with custom template and close it and then check the snapshot it shows detached nodes. Those nodes don't show if i don't open modal at all.
Which versions of AngularJS, Material, OS, and browsers are affected?
Angular js - 1.6.8
OS - linux/ubuntu 14.04
browser - chrome 65