Closed Bug 334322 Opened 19 years ago Closed 19 years ago

flash ads (*.swf) cause memory growth, reduced testcase shows 100MB per hour!

Categories

(Core Graveyard :: Plug-ins, defect)

x86
Windows XP
defect
Not set
major

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: nivtwig, Unassigned)

References

()

Details

(Whiteboard: [flash bug])

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060406 Firefox/1.6a1 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060406 Firefox/1.6a1 Memory use grows substantially with time, when viewing sites with flash animations/ads (*.swf files), until the browser slows down/hangs due to swapping memory to disk. This is NOT a memory leak since the memory is reclaimed when closing tabs, but is maybe caused by memory fragmentation. I attach a reduced testcase that contains only 1 local page with flash ads, which shows memory growth of above 100MB per hour !. I used Deer Park Alpha 2 in Safe mode, to prevent any problems caused by extensions. Seems to me that this behavior/bug is at least since the FireFox 1.5 release (I don't know what happened before). I have 512MB of memory which is adequate at the start, but due to the memory growth, it is all exhausted, and starts swapping to disk, making FireFox hang for a long time. For example of a normal use (not the reduced testcase): reading articles in the Hebrew versions of www.globes.co.il,www.themarker.com,news.walla.co.il - major Israeli news sites, which contains 4-5 ads per page, when you open 10-20 multiple tabs with different articles The first step is to check whether the problem is with Firefox or with the Flash player plugin (I am using the latest version 8,0,24 ) Notes about workarounds: *) Using AdBlock is not an option - I want to see the flash ads/animations. *) Restarting with SessionSaver is also not an option - articles in these sites expire and move to archive after some time. Restarting causes losing the ability to read those articles. I believe this is one of the main reasons for people complaining about slow memory growth in Firefox, since almost every site nowadays uses flash ads. Reproducible: Always Steps to Reproduce: 1. unzip the reduced testcase 2. Open the browser and open 4 tabs with the same local html file ff_swf_mem.htm (which contains about 40 flash ads from the above sites). The usage of 4 tabs is to accelerate memory growth, you can use 1 tab and grow the memory more slowly 3. Check the memory usage at the start after all pages finished loading, using Task manager 4. Do nothing, leave it for several hours (5-10), and check from time to time the memory usage . 5. close all tabs, replace the last one with www.google.com. check the memory usage. (The memory is reclaimed and dropped, i.e. no memory leak Actual Results: Memory grows from ~400MB to ~1.2GB, 800MB in 5 hours !!! Memory usage as reported by Task manager on 2.4Ghz Intel Celron, 1GB memory Stage Mem Usage VM Size ========================= ========= ======= Memory usage at the start ~200MB ~200MB After 1 hour ~260MB ~260MB After 5 hours ~600MB ~600MB Closing tabs, replacing with google ~30MB ~30MB Expected Results: no memory growth or small memory growth.
Surely this is a bug with the flash plugin, since as you note without flash running there is no memory increase.
Added reduced testcase showing flash ads causing mem growth above 100MB per hour. I had to reduce the original testcase further by about half since bugzilla doesn't allow attachments of more than 300KB (mine was twice 590KB), so the memory growth as shown in the bug description may be slower, since I reduced the number of ads on the page. In any case, to cause higher rate of memory growth, open more tabs. The testcase contains a simple page with only ~20 flash ads from the site www.globes.co.il (the Hebrew version), Opening 4 tabs with the reduced testcase page represents opening 10-20 tabs with 4-5 flash ads in each article from this site.
(In reply to comment #1 ) This is not surely a problem with the flash plugin. A programmer/developer needs to check this. It might be caused by Firefox due to the interaction/interface with the flash plugin.
Component: General → Plug-ins
Product: Firefox → Core
QA Contact: general → plugins
Version: unspecified → Trunk
Severity: critical → major
With ten tabs opened to http://www.globes.co.il in Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060416 Firefox/3.0a1 and Shockwave Flash 8.0 r24, I see no increase in memory usage over time. What I do (and what at least one Mozilla developer has found acceptable to do) to see if a problem is with a plugin or with the browser is to test in Opera. If the problem does not occur in Opera with the same plugin, the problem must be with the browser. In this case, we already know the problem is not in the plugin because I'm using the same plugin as the original reporter, and I don't see any memory growth. Reporter, can you retest in a recent nightly trunk build with a new profile?
(In reply to comment #4 ) *) Steve, why didn't you use the reduced testcase I attached? *) You didn't follow my steps to reproduce using the reduced self contained testcase (they didn't include using the site www.globes.co.il, I specifically created a reduced testcase to reduce it to only flash ads), did you use the Hebrew or English version of the site? The Hebrew version has many flash ads, the English version does not show the problem. In addition, you should open many Hebrew articles. *) How much time did you wait? It seems you waited a very small amount of time since I opened the bug - only 2 hours, in this case the memory growth is slower. *) I made my tests with Firefox in safe mode, which doesn't load extensions, why isn't it enough and I have to create a new profile? I will try the new profile test later in any case with the latest build. But I don't expect different results - I already tried the same test with a more recent version "Minefield" in safe mode (dated 20060413) on the www.globes.co.il site (not the reduced testcase) with the same results. Thanks for the quick response, Niv
(In reply to comment #4 ) I have retested and the problem still occurs on a new clean profile, on the latest trunk build of Minefield: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060416 Firefox/3.0a1 The test was done with the reduced testcase with 7 same Tabs open to the reduced testcase page. The memory growth was ~120MB in 25 minutes. Stage Mem Usage VM Size ========================= ========= ======= Memory usage at the start ~200MB ~200MB After 25 minutes ~260MB ~260MB Steve, others, can you please retest with the reduced testcase to confirm, so we know that we tested the same.
With the reduced test case, Firefox and Opera both eat up about 120 MB per hour with Flash 8.0 r24 on Windows XP SP2. I think you should report this as a bug in the Flash plugin at <http://www.macromedia.com/cfusion/mmform/index.cfm?name=wishform>. It might be that the Flash code in the ads themselves are leaking memory. You might want to inform whoever wrote the Flash code of the problem, too, in case they can fix the leak in their code.
The flash plug-in consumes 1500MB of ram when playing a 120MB (37 min) SWF encoded with flash 4, when drag and dropping the file into the firefox 0.6 - 1.5.02 Browser window. It is also the same memory size with the Firefox 3.0a1 Nightly. The memory consumption is dramatically less with IE6 SP2, and IE7 Beta (200MB). The flash plugin version is 8.0.24.0 (installed with downloaded file)
I reported this as a bug at the Macromedia web site as you suggested. However, I still think that this bug should be confirmed in order that it will be tracked down until full resolution by either Macromedia or Firefox developers (although it might not be their "fault"), since it is affecting the experience of millions of web users. In addition, This bug should be confirmed since Firefox developers still have things that they can do to prevent or alleviate this - they can create a new option - "Stop flash animations in hidden Tabs from Playing", to alleviate this problem. That way unnedded flash animations, that are currently hidden in other tabs, will continue to play only when visible. I am not familiar with flash scripting and coding, are you sure that it is possible to leak memory in the ads code, and that this is not due to memory fragmentation? As I showed previously this is not a memory leak in Firefox, just memory growth (since the memory is reclaimed when closing tabs). We need someone from Macromedia to tell whether this is a problem with the flash player or the ads. BTW, I cannot contact the ad developers, they are scattered all around the world :)
(In reply to comment #8 ) Adam, what you are describing might be a totally different problem, and I think it should be filed as a different bug, you also didn't give a link to the specific 120MB file. What I am talking about is NORMAL randmom flash ads that I collected, 20 ads, only 15KB each on average. What you are describing is a special case, 120MB flash file, that probably contains special cases/operations that are not found in normal flash files. It should be checked however, how IE flash plugin deals with the reduced testcase, as you noted. I will try this later.
(In reply to comment #9) > I am not familiar with flash scripting and coding, are you sure that it is > possible to leak memory in the ads code, and that this is not due to memory > fragmentation? If it were memory fragmentation, I would expect the meory growth to stop at some point. The fact that the memory use keeps growing at a steady rate suggests that memory is being continually allocated. If Flash allows any memory allocation, then Flash code can certainly allocate memory and not deallocate it (or not allow it to be deallocated). From this page <http://www.gskinner.com/blog/archives/2005/10/major_flash_pla.html> it looks like it's very easy to write Flash code that causes this kind of memory growth. If this is a problem with Flash code, we can change it to a Tech Evangelism bug on the site with the bad code. If it's a bug in the Flash plugin, I think the proper resolution is to mark this bug invalid, as it's not a bug in Firefox or on a web page. As far as I know, Bugzilla doesn't track bugs in plugins.
(In reply to comment #10) > It should be checked however, how IE flash plugin deals with the reduced > testcase, as you noted. I will try this later. IE reacts a bit differently to the test case, but according to <http://www.macromedia.com/shockwave/welcome/> my IE is using Flash 6.
Thanks for this bug report. We (the Flash Player team) will investigate. Note that we have a Flash Player 8.5 beta out where this could be fixed, though I haven't tested it yet. The beta can be downloaded from here: http://labs.macromedia.com/technologies/flashplayer8_5/
(In reply to comment #13) > Note that we have a Flash Player 8.5 beta out where this could be fixed, though Issue remains with Flash 8.5. IE also leaks, but not as much as Firefox.
I am re-asking since no one answered, maybe people from the Flash player team can answer, is it possible to stop flash animations from playing (and maybe also release unneeded memory resources or call the garbage collector) when tab is not in focus to alleviate this problem? (regardless of any fix in the flash plugin itself) I am also curious to know whether a flash plugin instance is instantiated for each flash animation, is there a virtual machine with a garbage collector for every flash animation, or one for all animations? Steve, the specific flash mem leak problem in the link you gave as example was fixed in the flash player (see the last comments) therefore it was not a coding problem. The flash plugin wasn't garbage collecting properly. As far as I undertand from this (correct me if I am wrong) any memory leak in the Flash player is not due to blame on coding, but due to problem with the garbage collector. Since flash has a GC, it should take care of all leaks and garbage collect them, without need for the programmer to code correctly (although it helps ...)
(In reply to comment #15) > Since flash has a GC, it should take care of all leaks and garbage > collect them, without need for the programmer to code correctly (although it > helps ...) Yes, but the programmer could write code that could allocate arbitrary amounts of memory and not allow the garbage collector to collect it (by keeping a reference to it), and the effect would be the same as what we experience as the continually increasing memory usage reported in this bug. The point is that it could be a problem in the plugin, or in the flash code. We won't know unless someone looks to find out.
Thanks again for this excellent bug report, and all the speculation :) We have confirmed this is a Flash Player bug and plan to fix it in the next major release. I will let you know when a publicly available Flash Player can be used to test this, in case you are interested.
Blocks: 246713
Confirming from comments
Status: UNCONFIRMED → NEW
Ever confirmed: true
-->NEW ? Surely INVALID, since it's a flash problem, not firefox?
I guess we can keep it open until it's fixed in the flash player.
Whiteboard: [flash bug]
(In reply to comment #17) Michelle, thanks for the quick "investigation". Can you give a more detailed explanation on when this bug happens, in which case ? If there is a discussion of this bug in the Adobe, or Macromedia sites or in any forum/message board, can you please give a link to it. Does it happen also in other browsers flash plug-ins (IE?) Can you give an estimated range of version numbers of the flash plugin, where this bug appears / started to appear? Does it appear in all 8.x (up to 8.5) flash players, did it appear also in 7.x, etc.
This memory leak also happens in IE but to a lesser extent. It definitely appeared in all Flash Player 8.x releases. It could have been in previous releases but it is somewhat doubtful and we haven't tested it.
Hi Michelle, Can you tell in what condition does this bug appear, what in the flash code causes it? What is the affect of this bug ? Do you estimate the possibility of flash animations causing it is rare, or frequent and might affect almost every site with flash animations ?
This bug is now fixed in Flash Player 9 beta 3: http://labs.adobe.com/technologies/flashplayer9/
Using Flash Player 9 beta 3, the testcase used up about 8 MB of memory in 8 hours, or about 1 MB per hour. As soon as I went to a new page, the memory was released. If there's any problem remaining, it's two orders of magnitude less than before, so it looks like it's essentially (99%) fixed to me.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Not a Mozilla bug so resolving as invalid.
Status: REOPENED → RESOLVED
Closed: 19 years ago19 years ago
Resolution: --- → INVALID
Note similar bug 342810 was filed using the fixed Flash 9 beta 3, but that one may be more likely to be a Mozilla problem since it happens on trunk but not 1.8 branch.
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: