6

In my company we are working on a SPA with multiple iframes. Occasionally some of the frames would not load on IE 11 because IE ran out of memory (the iframe content could be quite heavy on the RAM but things are okay on Chrome and FF).

In fact we monitored the fact that each time we reload the page, the memory used (data taken from either IE memory analyzer or the windows task manager) kept increasing until it reaches a 1.6Gb threshold.

I've found this very interesting post and I thought that all my troubles would fly away. As we are not using jQuery I adapted this provided snippet to vanilla JS. My idea was to clear the frames before the page reload to check if the memory used would be reclaimed.

Here is the code I wrote :

window.addEventListener('beforeunload', function () {
    [].slice.call(document.querySelectorAll('iframe')).forEach(function (frame) {
        // remove all frame children
        while (frame.contentWindow.document.body.firstChild) {
            frame.contentWindow.document.body.removeChild(frame.contentWindow.document.body.firstChild);
        }      
        frame.src = 'about:blank';
        frame.parentNode.removeChild(frame);
    });
    // force garbarge collection for IE only
    window.CollectGarbage && window.CollectGarbage();
});

I then opened the memory profiler of IE and reloaded the application. However very little of the memory was reclaimed and I ended up with something like this memory diagram

Am I missing something. Has some any information or piece of advice ?

Thank you.

Community
  • 1
  • 1
kalnic29
  • 309
  • 4
  • 13
  • We are facing the same issue with IE and we already tried everything we found. My impression is that there isn't anything we can do in our side. This bug https://connect.microsoft.com/IE/Feedback/Details/1742276, which details the iframe memory leak, was closed as "Won't fix". – Rafael Maiolla Jan 26 '16 at 12:36
  • Thank you @RafaelMaiolla for the link to the issue. – kalnic29 Jan 26 '16 at 16:38
  • I've found an additional one https://support.microsoft.com/en-us/kb/3120078, saying that they have fixed a memory leak when using removeChild or appendChild for an iframe in IE11. This is a recent one, I'm still trying to install the update to test. – Rafael Maiolla Jan 26 '16 at 16:46
  • I've also had words that them were supposed to have fix something in latest releases. However I have tested on 11.0.26 (KB3104002) and I could still face the issue. My version of IE was updated to https://support.microsoft.com/en-us/kb/3124275 (11.0.27). I have not yet tested on this version. I will report here asap. – kalnic29 Jan 26 '16 at 16:52
  • 1
    So I did the same thing with the newest version of IE that I could get (11.0.27 as mentioned in comment above) and unfortunately the outcome is the same. Maybe the memory increases a little bit slower but I cannot be sure about this. – kalnic29 Jan 27 '16 at 08:55

0 Answers0