angular / angular.js

AngularJS - HTML enhanced for web apps!
https://angularjs.org
MIT License
58.83k stars 27.51k forks source link

ng-if memory leak in 1.3.0-beta.13 #8105

Closed Vye closed 10 years ago

Vye commented 10 years ago

There seems to be a bug with ng-if in 1.3.0-beta.13 that prevents listeners and nodes from being removed or reused which depending on the amount of data being rendered can make memory usage go through the roof (1G in 5m on one of my apps). I wrote a plunkr to demonstrate: http://plnkr.co/Wcl9eJWy1AXqcNr8rpf1

Memory screenshot: https://dl.dropboxusercontent.com/u/3205027/angularjsbug/Wcl9eJWy1AXqcNr8rpf1.png

If you turn on the memory timeline in Chrome dev tools you will see with each render more listeners and nodes get added but not removed.

1.2.19 does not have this problem. Here is a fork of the plunkr above that doesn't continually consume more memory: http://plnkr.co/xhs07opbT4M7fwkdyu56

Memory screenshot: https://dl.dropboxusercontent.com/u/3205027/angularjsbug/xhs07opbT4M7fwkdyu56.png

P.S. Angular is sweet. Thanks for all the hard work.

Narretz commented 10 years ago

Hi, have you tried with 1.3.0-beta.14? It included some fixes that might affect this.

Vye commented 10 years ago

The issue does not seem to be present with 1.3.0-beta.14.

Thanks.