Ember.js: Internet Explorer 11 process memory leak

Created on 29 Jul 2016  ·  31Comments  ·  Source: emberjs/ember.js

I'm not sure if this is an Ember issue or an Internet Explorer issue...

I have created a sample application that illustrates the problem at https://github.com/jdenly/ember-ie-leak, using Ember Canary. It contains an Ember CLI generated application with two routes and a couple of links on the application template.

Loading the application, either using ember s or a production build in another web server and then clicking between the two routes causes a process memory leak in Internet Explorer 11 (specifically 11.0.9600.18349, update version 11.0.32 (KB3160005)).

Using the IE developer tools shows all objects allocated are cleaned up when clicking between the routes, yet the heap size and process memory is still growing.

ieleak

Drilling down into the retained objects seems to show HTMLDivElement being retained.

ieleak2

If I run the same test in Chrome (Version 52.0.2743.82 m (64-bit)) and take three snapshots repeating the same movement between routes in each one, I can see all objects allocated between snapshot 1 and 2 are gone.

ieleak3

I have also created a Selenium test that just clicks between the two routes using the links. When run for 100 iterations in Internet Explorer, it shows a saw tooth growth of process memory. Calling CollectGarbage() has no effect on the process memory in use and if run for long enough (around 300 iterations), Internet Explorer will top out at about 1.7GB of memory in use and will crash.

ieleak4

This same test can be run for 10,000 iterations in Chrome without causing this growth of process memory (as reported by Chrome Task Manager). Chrome's process memory for the tab rises to about 110MB and then stabilises for the length of the test. Once the test finishes, the memory drops back to ~50MB, unlike IE that never drops.

I have found a reported memory leak in Internet Explorer Edge and 11, but this seems to relate to not cleaning up when the application is reloaded.

https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8020622/

Coincidently, this Ember app also seems to be affected by this bug but I don't know if this is related to the process memory growth when not reloading the application.

Needs Bug Verification memory leak

Most helpful comment

@stefanpenner I'm trying to source a system onsite that has Edge. I'll report back when I find one.

All 31 comments

@jdenly thanks for the great issue! Curious, do you see this issue in other versions of IE, for example edge?

@stefanpenner I haven't tested with Edge, I'll have to get access to a Windows 10 machine to check. I'll get back to you.

@jdenly it would be handy for an additional data point. I need to get a windows setup again on my latop, I will try remember and dig in this weekend.

@stefanpenner I've run the test against Edge and it's fine. I ran 10,000 iterations without a problem, process memory never went above ~260MB and dropped once the pressure was off the browser at the end. The JS heap was 208B larger at the end.

ieleak5

I also tested again in the version of IE 11 on the windows 10 machine (11.494.10586.0 update version 11.0.33 (KB3170106), rather than the slightly different version on my windows 7 machine and whilst that shows the process memory growth in the load test (unlike edge), it doesn't show the heap growing or the retained objects when manually clicking between routes (unlike 11.0.32 on windows 7).

ieleak7

I think this is an Internet Explorer specific bug in 11.0.32 rather than an Ember issue.

@jdenly interesting. It may still be something ember can avoid, or at the very least we should attempt to confirm w our friends over at MS.

@felixrieseberg / @bterlson do you two fine fellows have any recommendations/thoughts?

I don't really have any insight, but I'll also add @reybango here, who might be able to get this fixed. My gut feeling: If there's no leak in Chrome, but in Edge, it's prooooobably an Edge bug.

@felixrieseberg danke :)

@felixrieseberg It looks like Edge is fine, the problem seems to be in IE 11. I am also using the remote web driver to test using Selenium, so perhaps that is related?

I've done a bit more investigation with different versions and OS's, summarised in the table below.

| OS | Browser | Process memory leak with web driver? | Heap size increases? |
| --- | --- | --- | --- |
| Windows 7 | Internet Explorer 11.0.32 | Y | Y |
| Windows 7 | Internet Explorer 11.0.14 | Y | Y |
| Windows 8.1 | Internet Explorer 11.0.31 | Y | Y |
| Windows 10 | Internet Explorer 11.0.33 | Y | N |
| Windows 10 | Edge | N | N |
| Windows 7 | Chrome | N | N |

@jdenly so it seems like IE has a fix 11.0.33+, does windows 7 and windows 8.1 also ahve IE 11.0.33?

@stefanpenner None of the Windows 7 systems I have seems to want to fetch it with windows update.

I think it's included in this Windows 10 update.
https://support.microsoft.com/en-us/kb/3172985
https://support.microsoft.com/en-us/kb/3169991

Which contains a few non-security related fixes in this patch:
https://support.microsoft.com/en-us/kb/3170106

I'll try and get it installed on Windows 7 or 8.1 and see if that resolves it.

@stefanpenner Finally got round to installing IE 1.0.33 on Windows 7 and the issue still appears to be happening, it's reporting 1.27KB of extra heap per navigation between the routes and back but the object count is steady.

Version: 11.0.9600.18376
Update Versions: 11.0.33 (KB3170106)

@jdenly is this still happening? @stefanpenner any way we can help you?

Thank you!

@stefanpenner any way we can help you?

Well, we may need to get a reproduction in order and see if this is a leak we can work around on our side. Honestly, my bandwidth for this is fairly low especially as it seems like some sort of browser bug.

We may want to again try to reach out to some IE team members, and see if they can lend a hand.

What i have experienced is that in Edge if you open dev tools to track memory it will freeze the process recycling (no memory is freed) best way to track how much memory is the IE process consuming is through task manager.
Please confirm if somone can reproduce it.

@reybango you have been recommended to use, do you have anythoughts ^

We are facing the same issue with IE 11 that happens when transitioning between routes. We have a scenario where we have a large list of items displayed on screen, we then drill down into one of the items and that loads another route. If we transition back to the route with the long list it's like the list is doubled as far as memory is concerned. Drill down again, transition back to the list, boom, another chunk of memory allocated. The memory never seems to be reclaimed. We are tracking the memory usage through Task Manager.

We do not see this behaviour in Chrome or Firefox

@ctataryn does this affect other windows browsers like edge?

@stefanpenner I'm trying to source a system onsite that has Edge. I'll report back when I find one.

Thanks, I'll definitely take a look. My guess is this is a problem with IE, and whether there is something that can be done in Ember to alleviate it… not sure.


From: Stefan Penner notifications@github.com
Sent: Thursday, April 13, 2017 3:48:18 PM
To: emberjs/ember.js
Cc: Craig Tataryn; Mention
Subject: Re: [emberjs/ember.js] Internet Explorer 11 process memory leak (#13940)

@ctatarynhttps://github.com/ctataryn have you used: https://docs.microsoft.com/en-us/microsoft-edge/f12-devtools-guide/memory ?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/emberjs/ember.js/issues/13940#issuecomment-294017413, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAamB6KDiIs6aXR3hne-hPrNitCF8DDgks5rvooSgaJpZM4JX7S_.

@ctataryn We are seeing something similar, which was why I started investigating this in the first place. We also don't see it in Edge, Chrome or Firefox.

I have recently upgraded to Ember 2.11 and the problem still persists.

Out of interest, are you using Ember Data?

Thanks, I'll definitely take a look. My guess is this is a problem with IE, and whether there is something that can be done in Ember to alleviate it… not sure.

Ya. If we can work around the issue, we would be down. Or atleast reporting the issue to our friends over at IE.

@ctataryn if you have good internet speed i suggest you to get the win 10 image and try it out: https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

@GramozKrasniqi thanks, I had grabbed that last week but I have yet to start it up. Still trying to measure the exact usage problems in IE11.

@jdenly hello, just wanted to check with you if you found the fix for this issue. I am facing the same process memory leak issue in our application. Right now, IE is eating 1.8GB memory and frozen up. We do use a lot of javascript and I was checking all kinds of circular references and closures in it but the fact that chrome doesn't have same issue, it made me more persistent to think that this is IE 11 issue. Right now my IE is:
IE version: 11.0.9600.18698
update version: 11.0.43(KB4021558)

@sudars10 Unfortunately not, we worked around it in IE by creating a mixin that hooks into the route activate, does browser detection and then reloads the application. We use this in our top level routes, so the application gets entirely refreshed by opening a new tab, clearing the existing tab and then closing it when you move between major areas of our application. I'm not happy with this approach, but it resolved the issue in IE, with the trade off of making those top level transitions slower and messing with the history.

I can't share all the code with you but the reload sequence that frees the memory is this:

var url = this.router.router.recognizer.generate(routeName, null);
var win = window.open(location.origin + url, '_blank');
win.focus();

window.open('', '_self', '');
window.close();`

We also use localStorage to keep track of whether we have reloaded already, to avoid loops. As I say, it's disgusting code but does the job.

@jdenly yep, 'reload' is the workaround as it seems. If anyone manages to script out a solution for IE11, it would be great. Thanks for your help.

Hmm. Definitely seems like this is a tricky one to track down. From the comment thread it seems like this is a browser bug which makes it quite hard for us to figure out a work around.

Out of curiosity, have you tested on more recent canary versions of Ember? There has been a great deal of cleanup done internally, and refactoring to more idiomatic JS in spots sometimes has a positive effect on these sorts of browser bugs...

Okay, in my case, when i refresh the browser(IE11), memory drops back to ~normal. So, below is my workaround:

function pageload()
{
var isIE = false || !!document.documentMode;
if(isIE)
window.setTimeout(pageRefresh, 28800000); //using setTimeout being on pageload(),
}

function pageRefresh()
{
window.location.reload(true); //passing 'true' to do page refresh from server
}

NOTE: i m doing refresh every 8 hours cause that about the time it starts being slow #ripIE11GC

Oh hey, it looks like this browser bug that was reported originally with this issue is fixed! https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8020622/

I'd recommend that we close this ticket, but feel free to reopen if it's still an issue.

@ryanlabouve for the link to the Edge bug, glad it's resolved. Closing, cc @jdenly

Was this page helpful?
0 / 5 - 0 ratings