User-Agent: Mozilla/5.0 (Windows NT 5.2) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.91 Safari/534.30
Build Identifier: Mozilla/5.0 (Windows NT 5.2; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Firefox accumulates memory indefinitely after visiting a website.
Steps to Reproduce:
1. Disable all plugins
2. Close Firefox
3. Start Firefox and check for enabled plugins. If there are such go to step 1, else close Firefox and continue to step 4
4. Start Firefox in safe mode
5. Maximize the Firefox window
6. Navigate to gamespot.com
7. Click "Click here to continue to GameSpot" on the page
8. Wait the next page to load fully
9. Minimize the Firefox window
Increase of the Firefox memory usage - after about 4 hours and 20 min the private memory of Firefox reached 500 MB. The following image obtained with Process Monitor shows the memory usage of Firefox for that time interval:
Constant or near constant memory usage within a reasonable bound. I didn’t observe accumulative memory usage pattern with Google Chrome 12.0.742.91.
I instructed Firefox to generate nspr log file in the beginning. Leak Gauge didn't find leaks in this log file. The attachment contains the information from about:memory obtained at the end of the test.
Created attachment 539190 [details]
about:memory at the end of the test
Step7 isn't necessary for me to reach the main page.
I can confirm that the used memory increased from ~80mb to over 200mb until I stopped.
tested with FF4.01 and disabled plugins and in the safemode
Sounds like this might be a dup of bug 656120.
The GC isn't triggered while firefox is idle. You could try the ff6 pre beta and see if the memory goes back down if you click GC + CC on about:memory.
It has to be done in ff6 as the update to about:memory didn't exist before.
Thanks for the precise steps to reproduce!
I performed two experiments.
I installed Firefox 6.0a2 on Windows XP (x86) and repeated the steps. I used Windows Task Manager (Mem Usage column) to measure the memory usage of Firefox. The results (in chronological order) are:
97 Mb – after loading the main page of gamespot.com
252 Mb – 1 hour and 15 min. later
235 Mb - after I restored the minimized Firefox window and pressed Cltr-t to open new tab
118 Mb – few seconds after I entered about:memory [Enter] in the location bar (in the new tab)
113 Mb - after I clicked the "GC + CC" button
104 Mb - 2-3 min. later
Hector, thanks for the detailed info, that's very helpful.
It's pretty clear the problem is due to insufficiently frequent GC:
- Attachment 539190 [details] shows that js/gc-heap accounts for 355,467,264 bytes out of 433,580,070 malloc/allocated
- GC does happen eventually (comment 5).
I talked to Gregor about this, he says that GC tends to happen quite infrequently, and that one would probably happen eventually due to heap growth.
So bug 656120 would help here, but the broader problem is that GC doesn't run often enough.
Hector, can you try a Nightly build? Bug 656120 was fixed and that will hopefully help a lot.
I installed Firefox build from 22-Jun-2011 on Windows XP (x86) and performed the steps. The memory usage (Working Set) of Firefox did not exceed 141 Mb for 9 hours interval:
The Kernel Time of the Firefox process at the end of the test was 24 minutes. What is the reason for this?
(In reply to comment #8)
> I installed Firefox build from 22-Jun-2011 on Windows XP (x86) and performed
> the steps. The memory usage (Working Set) of Firefox did not exceed 141 Mb
> for 9 hours interval:
Great! Time to declare victory :)
> The Kernel Time of the Firefox process at the end of the test was 24
> minutes. What is the reason for this?
I guess Firefox is making some system calls. One possibility is the url-classifier, which periodically downloads new information about malware sites from a server. See bug 650649 for more details.