Closed Bug 1384857 Opened 7 years ago Closed 7 years ago

Nested iframe memory leak with external javascript

Categories

(Core :: DOM: Core & HTML, defect, P5)

54 Branch
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: mackatack, Assigned: mccr8)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0 Build ID: 20170628075643 Steps to reproduce: For a business application we have many nested iframes. We've noticed that Firefox has been using more memory than normal. It seems that Firefox never cleans detached iframes, especially when having iframes inside iframes. This gives huge memory problems for sites with nested iframes. We've been able to pin it down to iframes in combination with an external javascript. Iframes with only inline javascript have no problems. Eventually Firefox starts eating up all available RAM because every frame takes up 1,5 to 50 MB (depending on how many resources are loaded inside the iframe). I have attached a testcase and a couple of screenshots. In my testcase the resources leaked are not that much because hardly any are loaded. Actual results: Open a page with iframes, or even iframes inside iframes. Create a javascript to remove the iframe from the DOM or navigate the main iframe to a new page. The removed or child iframes will not be garbage collected. Even if GC and CC are forced by using about:memory. Doing exactly the same for an iframe without external javascripts have no problem and are nicely GC'd. Firefox will only GC the detached windows when the top level window is navigated away or closed. This is impossible with big enterprise portal pages which use iframes etc. Funny thing is that Firefox will only keep one zombie iframe when you use the same URL. Therefore the testcase adds something random to each URL. Expected results: All (nested) iframes should be removed from memory upon navigating away or removal from the DOM, not only iframes without external javascripts.
Component: Untriaged → JavaScript: GC
OS: Unspecified → All
Product: Firefox → Core
Hardware: Unspecified → All
Tested on Win10 64bit and 32bit and Ubuntu 64bit with Firefox 54. Same results. Furthermore in the testcase if you sequencely keep spamming "Create Iframes with external js" and then "Step 2: cleanup iframes" you'll clearly see RAM usage ramping up. This memory will not be released, until you navigate the toplevel window elsewhere or close it. In some cases zombie windows even keep existing until Firefox is closed.
Andrew, this sounds like it could be a DOM issue. Any thoughts?
Flags: needinfo?(continuation)
Yeah, it sounds like a ghost window kind of issue. I'll take a look next week.
Assignee: nobody → continuation
Component: JavaScript: GC → DOM
Flags: needinfo?(continuation)
Sorry for the very long delay before anybody looked at this. I am unable to reproduce this issue using your test case in Firefox 57. Can you reproduce this in more recent versions, such as 55? Do you have any addons installed, or is this a fresh profile?
Flags: needinfo?(mackatack)
Priority: -- → P5
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Flags: needinfo?(mackatack)
Resolution: --- → INCOMPLETE
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: