Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

angular + jquery: memory leaks in IE8 #1216

Closed
ghost opened this issue Aug 1, 2012 · 11 comments
Closed

angular + jquery: memory leaks in IE8 #1216

ghost opened this issue Aug 1, 2012 · 11 comments
Assignees

Comments

@ghost
Copy link

ghost commented Aug 1, 2012

When using angular with jquery and setting up route navigation, scope object(-s) leaks in IE8 (hasn't been tested in IE9) when switching between views.

Please see http://jsfiddle.net/ADukg/467/

Notes:

  • view that leaks should contain ngModel directive;
  • when removing jquery, the sample above doesn't leak;
  • i am using window.CollectGarbage() to enforce IE to collect garbage.
@ghost
Copy link
Author

ghost commented Aug 6, 2012

Did anybody manage to reproduce the problem?

@IgorMinar
Copy link
Contributor

Pawel, can you reproduce this on windows?

@petebacondarwin
Copy link
Contributor

If I run the fiddle in its own browser window in IE9 on Win7 and click
between the two views repeatedly it does appear that the memory usage (as
measure in Windows Task Manager) is increasing each time.
Pete

On 18 November 2012 20:49, Igor Minar notifications@github.com wrote:

Pawel, can you reproduce this on windows?


Reply to this email directly or view it on GitHubhttps://github.com//issues/1216#issuecomment-10491317.

@pkozlowski-opensource
Copy link
Member

@IgorMinar @petebacondarwin Yeh, I can confirm this in IE9 / Win7. It also happens when I remove jQuery (!) on the AngularJS 1.0.2. Here is the jsFiddle I've used: http://jsfiddle.net/8Suhj/1/

Chrome and FFox show healthy patterns so this is indeed IE-only issue.

@EugeneZarya Did you observe this only with jQuery? Or you dimply didn't have chance to test without jQuery?

@ghost
Copy link
Author

ghost commented Nov 20, 2012

It looks very weird because I haven't observed this without jQuery. You are right, now it leaks even with single AngularJS.

@pkozlowski-opensource
Copy link
Member

So, a small update on this one: I've just noticed that in the example jsFiddle the same controllers are referenced twice: once on a route level and another time in a partial. If I remove controllers from partials (as those normally shouldn't be there) the leak goes away: http://jsfiddle.net/8Suhj/4/

Still, don't have enough knowledge of AngularJS to know how to interpret it but maybe it will ring a bell to someone...

@ghost
Copy link
Author

ghost commented Nov 21, 2012

For sure, the last jsFiddle doesn't leak. But still, if ngController is defined within a partial, the application leaks: http://jsfiddle.net/9r2sW/

@pkozlowski-opensource
Copy link
Member

@EugeneZarya Sure, I'm not saying that we should abandon investigations here :-) Just trying to narrow it down. Now I'm a bit suspecting that this is linked more to the ng-controller than to routes. As a next step I want to change routes to ng-include to see if it still leaks. If so it would mean that the ng-controller is a culprit here.

@pkozlowski-opensource
Copy link
Member

OK, a much simpler reproduce scenario without jQuery and routing, only ng-switch and ng-controller used, the leak is visible as well. So the pattern seems to be a new scope with a controller filling in a scope with "big" data:
http://jsfiddle.net/3ZdsB/10/

@alkis
Copy link
Contributor

alkis commented Dec 5, 2012

Is it possible that this is an NFE leak? The only possible NFE leak I see in the code is in compile.js. To fix it you can do something like this: https://github.com/alkis/angular.js/commit/8465b9acc809b416ee0da4accada4bb89729516c

@btford btford closed this as completed Aug 24, 2013
@btford
Copy link
Contributor

btford commented Aug 24, 2013

As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months.

Please try the newest versions of Angular (1.0.8 and 1.2.0-rc.1), and if the issue persists, comment below so we can discuss it.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants