ng-if memory leak #11618
Description
I've noticed a possible memory leak with the ng-if directive. It appears to be failing to garbage collect HTML Elements.
I've set up two fiddles to compare ng-if with ng-show (which doesn't have the same issue).
ng-show - http://jsfiddle.net/neridum/8vo7ae8L/
ng-if - http://jsfiddle.net/neridum/hptt8wmu/
I simulated this by running a Heap Allocation profile and clicking between the views a few times (Incognito in Chrome Canary). With ng-if there is a left over HTMLDivElement that looks to be detached.
This doesn't appear to be for a specific version and is apparent with 1.2.1, 1.3.9 and 1.3.15.
I found a Stackoverflow post suggesting to run a cleanup method but I'm not sure that this is a suitable approach - http://stackoverflow.com/questions/26022481/ng-if-causing-memory-leak-in-angular-js
A related issue to this is #9748