开发者

Firefox Iframe Memory leak

开发者 https://www.devze.com 2023-01-02 13:45 出处:网络
We are working on a JavaScript application that does has been crashing for no reason that we can see. The nature of the application is that it uses javascript to redirect the page every few seconds. a

We are working on a JavaScript application that does has been crashing for no reason that we can see. The nature of the application is that it uses javascript to redirect the page every few seconds. and rotates through a number of web pages in a set ammount of time.

So in searching for a potential memory leak in our code we set it up to run in firefox for a few days. while it was running we daily took note of the firefox memory use. It did as we suspected. the memory foot print grew over that time. so we decided to test firefox using the following setup: two html pages, each having an image on them. both use a meta redirect to keep up the switching between pages. these pages are displayed in an iframe on a 3rd page.

This set up showed the s开发者_运维知识库ame result. an increasing memory allocation over time. however. it should be noted that we tested this same setup in firefox but without the Iframe, and saw no increase in memory usage.

so the question: Any ideas what would be causing this? or does anyone know if there are any reported memory leaks in Firefox when using an Iframe and page redirection?


We found the Firefox + iframes memory leak acknowledged at https://bugzilla.mozilla.org/show_bug.cgi?id=858615

We have been experiencing it here on a Mac, using this code in html for an ip camera

<tr>
<div class="box">
<iframe src="http://10.0.1.31:8031/mjpeg.cgi" width="460" height="345"
  class="smart_sizing_iframe noresize" frameborder="0" scrolling="no" >
</iframe>
</div>
</tr>

Safari does not have this problem.


Did the rate of increase of memory use decrease over time and eventually stop, or did it keep growing? Some increase in memory is expected at the start of a test like that, because of memory fragmentation.

Is the testcase posted somewhere?


In an application I am working on I have observed the behavior in firefox where the javascript in the Iframe document references the parent doc like such:

$('#md-frame', window.parent.document).css('pointer-events','none');

I have noticed that if you reload the src of the iframe then all of the javascript in the iframe exists twice as if there are 2 instances. If you refresh the src of the iframe again all events in the js of the iframe exist 3 times and so on... So too me this could be an obvious memory leak.

This is how I reload the iframe src:

$("#md-frame").attr('src',$("#md-frame").attr('src'));

I have attempted to unbind all events before the strange behavior rebinds them but am not having much luck.

If anyone else has experience with this. Id appreciate hearing about it. We're still wrangling with this issue in firefox.

0

精彩评论

暂无评论...
验证码 换一张
取 消