Open Bug 629606 Opened 10 years ago Updated 3 years ago

Apng ram usage doubles upon scrolling

Categories

(Core :: ImageLib, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

()

UNCONFIRMED

People

(Reporter: brmpfi, Unassigned)

References

()

Details

(Keywords: testcase, Whiteboard: [MemShrink:P3])

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows NT 6.1; rv:2.0b11pre) Gecko/20110126 Firefox/4.0b11pre
Build Identifier: Mozilla/5.0 (Windows NT 6.1; rv:2.0b11pre) Gecko/20110126 Firefox/4.0b11pre

Testing for ram consumption, i set 40 704x74 apng banners of 66 frame loops at 3.72MB each on a page totaling 150MB, which after some seconds upon opening (apng's take a while to load), my page ram usage was 780MB. I let it sit a while and it did not change. Then i began to scroll down the page and ram usage began jumping upwards until it reached 1620MB. I tried this again and observed that as i scrolled to different points it would increase, until i had scrolled to every point possible and thats when it reached 1620MB. It only increases at points where you click to or let go at. 

Reproducible: Always

Steps to Reproduce:
1. Download the attached project files, copy the apng into 40 iterations (or less if you dont want to repeat my results), and rename to 1.png, 2.png,...40.png. Observe ram before opening.

2. Load page and note ram usage.

3. Begin moving the scroll bar in different ways and watch ram jump at each point. 
Actual Results:  
Ram usage doubled.

Expected Results:  
Ram usage should have stayed the same. 

I believe firefox is saving an iteration of the page at different points along the scroll bar.
Component: General → ImageLib
Product: Firefox → Core
QA Contact: general → imagelib
I ran a test on opera v.11.01 (as its the only other browser with apng support) and observed the following:

Load times
moz- 10s of blank before loading
opera - instant

Apng performance 
moz - laggy
opera - smooth

Scroll smoothness
moz - staggers
opera - smooth

Ram usage on load
moz - jumps to 700MB after 10 sec load.
opera - climbs to 700MB in 10 sec.

Ram usage on scroll
moz - up to double
opera - stays the same

But hey, who the hell cares about apng, lets all go back to apng and tables while the mozilla team tries to implement some more features we dont need.
*gif

god im tired.
(In reply to comment #1)
> But hey, who the hell cares about apng, lets all go back to apng and tables
> while the mozilla team tries to implement some more features we dont need.

Well, I'm sure the devs will want to look at this bug, now...
brmpfi:  thanks for the report and the measurements.  As for the last sentence in comment 1 -- you made that comment less than 24 hours after you first reported the bug.  All Firefox devs are currently flat out fixing blockers for the 4.0 release.  Please be patient.  There's a chance someone will get around to looking at this issue, but I suspect it will take a few weeks at the absolute minimum.
Ah, just like [url=https://bugzilla.mozilla.org/show_bug.cgi?id=585375]this report[/url] of apng's bloated ram usage in august 2010 was resolved. Or the fact that this isnt new to FF4.

No, my cynicism is founded and my remark stands. Firefox consuming 11x the ram of an images size id like to think is a bit more critical than anything else.
Cannot reproduce. I don't see any changes after scrolling.

about:memory reports:

images/content/used/raw 156,408,694
images/content/used/uncompressed 541,896,780

It is consistent with what I would expect from the test files:
3,910,195 * 40 = 156,407,800 (149mb)
704*74*4*65 * 40 = 541,798,400 (524 mb)
Yeah, i was having a bit of trouble reproducing it recently. It takes a bit of time before it will start to climb, or at least it did, until i found out how to trigger it right away. Scroll to any point on the page and click refresh, then scroll to another point and repeat. If you refresh on the same point the memory usage will reset itself. Also the animation stops on refresh, should i submit another bug report for that? And the animation lags alot, call that apng bug report #3? None of these issues are present in opera.
The animation failing on refresh is probably bug 601723, which should be fixed. Are you seeing this in the latest nightly?
Yeah, tried the latest nightly and the animation failing on refresh is gone. The ram spike on refresh is still there, along with the laggy performance.
Are you using Hardware Acceleration?
No, is that enabled by default? I can try it if not.
I was getting about 12fps on the hardware acceleration test until i enabled acceleration in about:config and got 64fps. I went back to my apng test to see if it would play smoothly and not only was it just as laggy, the memory started climbing as soon as i scrolled. 

645MB ram utilized baseline
1.54GB ram on pageload
Had to quit scrolling before it maxed out my ram.

Hmm...thats odd....

So i went ahead and disabled HW acceleration and tried again:

640MB baseline
1.35GB on pageload
1.36GB on scroll.

ah, ok, now we're seeing the culprit. Re-enabled HW acceleration:

640MB baseline
1.54GB on pageload
My RAM meter scrolled up with the page. 

The performance is actually worse with HW acceleration, despite the use of resources. I believe the reason i observed this before and not later was that i updated FF since then, so there was some sort of settings change that disabled it. 


http://demos.hacks.mozilla.org/openweb/HWACCEL/
What about:memory tells you? 

Especially sections named:

images/content/used/raw
images/content/used/uncompressed
To clarify, i have two computers im testing this on, both with the b11pre. One is a core i7 workstation with a nvidia 9600GT on win7x64 which FF enables HW accel by default. Attempting to enable gfx.direct2d.disabled causes firefox to freeze, which then if i end its process and boot back up it is enabled. Regardless of its setting, images/raw and images/uncompressed show 0. There is no memory leak on scroll on this computer. I get 64fps with hw accel enabled and 23fps disabled. 

My other computer is a Core2 desktop with integrated intel HD graphics (graphics on a chip) on win7x86. FF doesnt recognize its hw accel capabilities by default, which if left off results in 14fps, and enabled, 64fps. Both settings show raw and uncompressed at 0. The memory leak on scroll is present only with HW accel enabled. 

Regardless of which setting/computer, performance is terrible. It appears to be playing at 12fps unless its completely left alone, which then it goes up near 24fps. If i scroll it takes about 5 seconds to reprocess (what i dont know) during which it will play at a few fps tops. Once again, none of these problems are present in opera.
One more note, memory usage in firefox continues to climb at a rate of 300KB/s even if i leave it open on a blank page.
Your about:memory results would be useful, particularly with the memory growth. Which category grows the most in about:memory?

Note that if you just refresh about:memory over and over, the JS stats will gradually increase. This is normal; the next garbage collection will clean those out, and so if you wait long enough the memory will drop back down. 

You should check the images/ data in about:memory.
What do you expect, to make you a movie? God you people expect me to work like your full time tester. If you want me to run through the hoops everytime you release a new version and report back every possible statistic, my rate is $200/hr. Ive told you how to trigger the problem, fix it yourselves.
I'm just another random dude like you. I'm not a developer. I haven't reproduced the bug, you have. If you want someone to fix it, you need to give them sufficient data to determine where the problem comes from. If this is a hardware acceleration issue, it may be related to your particular computer and graphics drivers, so your input is necessary.

In the spirit of being helpful, however, I'll see if I can reproduce this later, when I'm done working on this major presentation.
I have tested this on Mac OS X 10.6.6 with 4b10 and OpenGL enabled. I cannot reproduce the RAM use increase on scroll. Here are my numbers:

Before page load:
img/content/used/raw 2881
img/content/used/uncompressed 4096
gfx/surface/image 293,396

Once page has fully loaded:
img/content/used/raw 156,410,681
img/content/used/uncompressed 541,804,704
gfx/surface/image 550,626,588
Total memory in use 793MB

These figures do not change significantly on scroll.

brmpfi: In comment 15 you reported 0 in your about:memory results. This does not make sense. Are you sure you weren't checking img/chrome/used instead of img/content/used? Also, can you check the gfx/d2d/* results? It may be a graphics acceleration issue specific to Windows, so the d2d info is relevant.

Everyone else: If you want to test this bug, I have put the full testcase online at:

http://www.scienceforums.net/etc/ff_apng/APNGtest.html

Be warned that the total APNG file size is around 150MB, so it will take a long time to download and use a lot of memory. Please be nice to my server.
I see similar numbers on Windows XP, maybe the problem is Windows 7 specific. 

Alex, I would be much easier on your server if you use a highly compressed example. Here's the one I made:
http://img137.imageshack.us/img137/2134/colors1.png

It is only 166kb compressed, but 64mb uncompressed. Put 8 of them on a webpage, and that should be 512mb uncompressed, close enough to the original test.
Been a month and no one from mozilla has even bothered to look at it. No wonder firefox has become such a piece of ****, but i guess you get what you pay for.
We try not to reward people for hurling abuse.
brmpfi: we don't appreciate language like that here. I appreciate you have been helpful and constructive further up this thread, and we thank you for that, but please reign in your language. Everyone is trying to make Firefox better - we are all on the same side.

Gerv
Oh look, someone from mozilla, did you guys finally get your one computer to work?
brmpfi: this is not helping your case. Any more of this, and I will disable your account. There's no reason Mozilla developers should have to put up with your snide remarks.

Gerv
Whiteboard: [MemShrink:P2]
Whiteboard: [MemShrink:P2] → [MemShrink:P3]
Marking this MemShrink:P3 because APNGs are rare, due to only Firefox and Opera supporting them.
URL provided in bug does not work anymore. Also this url (http://www.scienceforums.net/etc/ff_apng/APNGtest.html) of testcase took years to load on my pathetic 1 MB connection. So What about these demo pages?
http://people.mozilla.com/~dolske/apng/demo.html

More:
http://littlesvr.ca/apng/images/012-dispose-none.png
http://littlesvr.ca/apng/images/012-dispose-background.png
http://littlesvr.ca/apng/images/012-dispose-previous.png

They maybe not memory intensive.. If any of you not mind, making a test case of it. I will try to post about:memory result with latest "mozilla-central" nightly.
Attached file test page
This test should use 512 MB of memory for uncompressed images.
Attachment #551282 - Attachment mime type: text/plain → text/html
(In reply to Max Stepin from comment #29)
> attachment 551282 [details]
> This test should use 512 MB of memory for uncompressed images.

Yep, That page does use 512MB of RAM on my machine (Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0a1) Gecko/20110913 Firefox/9.0a1 with 6GB RAM and 1GB Dedicated GPU).
It also uses 512MB of Dedicated GPU Memory once all frames of all APNGs have been displayed once (this involves viewing the entire animation of each APNG from start to end, including the need to scroll to any that are not visible and repeating there). Best viewed using the graphs in Process Explorer.

I think I know where this so called 'leak' of the original report comes from now.

(In reply to comment #15)
> My other computer is a Core2 desktop with integrated intel HD graphics
> (graphics on a chip) on win7x86.

Integrated graphics cards tend to have no dedicated memory and so they always use shared memory. Since shared memory is stored in normal RAM and is reported with the process as used memory it can be expected that once 512MB of graphics memory is used on this system that 1GB of memory will be used for that page.

I cannot test this out because I do not have a test machine available with the required configuration but I believe this is the most likely cause.
Keywords: testcase
You need to log in before you can comment on or make changes to this bug.