Re: Leaking memory using Angular nested ng:repeat in Chrome

1,464 views
Skip to first unread message

Matt McClellan

unread,
Aug 8, 2012, 8:38:20 AM8/8/12
to ang...@googlegroups.com
I've noticed this same issue in Chrome, and confirmed that it doesn't happen in Firefox.  Has anyone found a solution to this?

On Sunday, June 10, 2012 6:22:47 PM UTC-5, Tomasz Kunicki wrote:
I replaced inner ng:repeat with simple directive and now it works fine. The problem is important to me because I want to use angular in console program that runs for weeks.

Code that runs without problems:


But this also proves that problem is ng-repeat directive.

 

Eddie Huang

unread,
Aug 8, 2012, 12:48:24 PM8/8/12
to ang...@googlegroups.com

john...@gmail.com

unread,
Aug 29, 2012, 5:09:47 PM8/29/12
to ang...@googlegroups.com
I have come across this issue as well.  I have a long running screen that has been crashing by running out of memory.

Simple example


I will try replacing the inner ng-repeat with a directive and see if that helps.

On Sunday, June 10, 2012 11:25:41 AM UTC-4, Tomasz Kunicki wrote:
I noticed that refreshes consumes all memory in Chrome browser (other browsers seems to handle the situation better). Is this angular of chrome bug? Maybe I do something wrong?
If you run this in Chrome browser it simply will eat 1GB (about 10 000 cycles) and than browser window dies. Other browsers like: Safari, Firefox and even IE9 seems to run without problems (they will use about 200MB).
It seems also that the problem appears only when you use nested ng-repeat directives.



Richard Emerson

unread,
Jun 19, 2013, 7:01:49 AM6/19/13
to ang...@googlegroups.com

Was there ever a diagnosis or fix for this issue?  I've just hit exactly the same thing.

I have two nested ng-repeats which build a small table (<10 rows x <10 cols), updated every few seconds.  The corresponding tab in Chrome quickly uses >700MB of memory.

Looking at a heap snapshot in Chrome, I see thousands (>5000) of these objects: "$get.Scope.$new.Child".  They retain a lot of memory (>15MB in my case) relative to other stuff in the heap.  But I don't know where they are coming from.

From this thread, it appears that using a directive instead of the inner ng-repeat is a kind of workaround, but that's quite difficult and it seems like it shouldn't be necessary.

Any clues gratefully received...

Thanks,
Richard

Richard Emerson

unread,
Jun 19, 2013, 10:53:13 AM6/19/13
to ang...@googlegroups.com

Ah ok, issue already opened here: https://github.com/angular/angular.js/issues/2624 , mitigated somewhat in latest angular, but it's really a bug in Chrome.  Nasty :(

Reply all
Reply to author
Forward
0 new messages