Why does Firefox 4 (4.0.1 specifically) leak memory?
Answer: I figured it out.
History lesson first. Ever since the 4.0.1 update, Firefox 4 has been crashing A LOT. It's gotten so bad that FF4.0.1 will eat memory with no end in sight and eventually Windows (Win 7 64-bit) forcefully close the program due to an out of memory error.
I have 8 GB of RAM installed. And, it would crash once it exceeds 1.5 GB of RAM used by Firefox 4. I've seen Firefox 4 go up to 1.85 GB of RAM in Task Manager. This is with 20 tabs open.
With the add-on Leak-Monitor, I've narrowed down the issue. Having only Leak-Monitor as the extension installed, all pop-ups point to how poorly Firefox 4 handles Javascript!
MSNBC Leak Monitor issue: Leak Monitor log from MSNBC.com
I've gotten more pop-ups from even support.mozilla.com because of the Javascript on this website.
Firefox 4.0.1 is leaking memory from every Javascript on every website I load. It's leaking memory as we speak with only this page loaded (one tab).
FIX IT! Firefox 4 is poorly handling Javascript, especially when multiple tabs are opened.
All Replies (19)
Leak Monitor pop up for Firefox's support forum.
Same issues. Seems like this version was ether not tested thoroughly on win7 machines , or they simply let it slide with the leak .
Edeziri
I have Win7 Home Premium with 4GB Ram and with JavaScript enabled. I don't see any real change from FF3 to FF4 in memory use. I never have more than around 6 to 8 tabs open at once and have about 30 extensions(some disabled). I check occasionally and have only once seen usage go above 200MB, when I was doing a special test - it is 114 at the moment.
I would suggest your problem is not Firefox or its combination with Win7.
Have you tried all the usual checks - Problematic Extensions, Firefox Safe Mode, new bare profile? A lot of add-ons will have changed on updates as well as FF4.
Be very suspicious of third party toolbars.
I've only tested it as follows: Only one extension: Leak-Monitor Add-on Firefox 4.0.1 One tab open
Whenever I opened a new website, Leak-Monitor would start popping up a memory leak it detected. I opened them up and I've noticed they were related to the Javascript on the website. You can see the two logs I linked above.
And, when I open a new tab with a new website that has Javascript, another Leak-Monitor pop-up.
The more tabs, the more pop-ups, and I would notice that memory just continues to crawl higher and higher.
That's when I realized this seems to be an issue with FF 4.0.1 leaking memory whenever Javascript is loaded on a website.
This will be my sign off. You seem to need more expert help.
As I said above, though, this is not happening to me; nor I would guess to a vast majority of users.
Forget the Leak Monitor for a moment. Have you tried my suggestions?
My next suggestions would be to try out with JavaScript disabled(Options>Content>Uncheck "Enable JavaScript".
I would follow this by uninstalling the Leak Monitor for a tryout - I would bet it is adding to your problems.
Other standard tests are to disable your Anti-Virus and Firewall programs for a brief test.
Edeziri
It also depends, I've noticed, on whether you're using the x64 or x86 version of Firefox. x86 uses less memory overall, because that's where they've had time to optimize the program over the previous 4 versions. All 4.0 did to x86 was a major graphical overhaul and making the browser a bit faster. x64 has had almost no time for testing compared to x86.
I notice that in my post above I forgot to mention that my Win7 is 64 bit. And as I said, no problems. Just for completeness - not much help I'll admit but I think you'll have to look somewhere else.
Win7 64 4GBs and FF is eating well over 500mbs of my memory (2-10 tabs). One more day and it's over to chrome! Has FF seen it's day or is it going to rebound? Stay tuned!!!!
Having a memory leak issue as well on 4.0.1 with OS X 10.6.7
Tried disabling all Add-Ons, it doesn't change anything. Firefox will continue to eat memory slowly, until there is nothing left. Even if you close all your tabs and just leave one open, it will still hold onto the memory it was using and in most cases continue to increase.
I've been using Firefox for a long time, but this is a serious problem that's been going on since Beta.
Have the same problem. Was just watching precise 4 streaming flash vids on facebook for 1 hour and it ate 300 MB of memory. It's like the then outdated videos don't free space after watching and are still allocated in memory instead of the cache on the hard drive. It's a real mess compared to 3.6.
Also had another issue when not so reading a twitter search stream over a period of time. FF didn't really release the timing sensitive old data.
I'm running XP64 on an more or less old fashioned machine. But i'm sure it counts.
octoberasian: I, too, am experiencing this phenomenon. I shut my system down, pulled the EIC cable, held down the power button - then replugged and rebooted. I closed down every unneeded application that I have set to auto-start. Finally, I opened a single Firefox 4.0.1 window and let it sit. It began with consuming 43 Mb of memory. By afternoon - about 5 hours later - it was up to 203 Mb. There is definitely something very wrong with this version. It does the same on all the machines we have, sans our server. We don't use the server for anything but being a server & it has some version of Firefox 3 on it anyway. No Java Scripts were running, nor were any Adobe ARM or any plugins. I noticed when plugins run - the memory leakage goes into overdrive. Hey, I'm just sayin'...
Same problem. Through all of the recent Firefox 3 versions, I haven't had to restart my browser more than like once every couple weeks or so. Now, just about every 24 hours, Firefox gets up to around 2GB of RAM used, leading to a crash.
I'm running Windows 7 on a 64 bit machine.
By the way, I tested this issue with ZERO add-ons and Windows 7 x64 still gives an out of memory error and closes Firefox 4.0.1. I've tested it opened with one tab, then five then ten and then 20 tabs. (Tabs include pinned tabs as well.) It seems to occur most often if you exceed 10 tabs containing web pages with dynamic content (DHTML) and Javascript. By that point, memory usage is 1.8 to 1.9 GB.
I switched to FF Beta 6.0 a1 and no problems. Windows doesn't report an out of memory issue. Memory usage stays at 900 MB to 1.2 GB with 20 tabs open.
I switched to FF Beta 7.0 a1 and no problems. Windows doesn't report an out of memory issue. Memory usage stays at 800 MB to 1.0 GB with 20 tabs open.
I've tried FF 5 Beta and no problems other than Flash 10.3 crashing every now and then. I would have to be forced to close plugin-container.exe*32 in Task Manager to get Firefox 5 Beta working again.
Conclusion: It narrows it down to 4.0.1 as being a buggy build.
Hardware acceleration does not affect this and whether or not it's enabled has no bearing on Firefox's memory usage except on how fast and smooth the webpage is rendered.
Hey I found what may help you with the memory problem (at least it helped me!)
Same memory leaking on OS X 10.6.7. Not a win7 issue, it's a Firefox 4.0.1 issue.
Hi,
I noticed today that FF will hemorrhage memory at a rate of 300 MB/hr just sitting there but when I go and click on a link or something, it will free it up. So, I can let it sit for a few hours, get it up the 1.5 GB, click on a link, and it will go back to 300 MB or so.
I'm curious is this is also the case for anyone here that is experiencing a memory issue. Perhaps it is only those who leave their browsers open and unattended for a while who will notice the problem.
Yet another hemorrhage here. It started around the time that FF 4 came out. I kept hoping that with thousands of people complaining about the same issue that it would get fixed. I'm on FF 5.0 and it's still not fixed.
The problem seems easy to reproduce:
1) Start FF in safe mode on a news article: "C:\Program Files\Mozilla Firefox\firefox.exe" -safe-mode "http://www.mercurynews.com/politics-government/ci_18403225" 2) Put Firefox in the background (I did not minimize it. I simply switched to using other applications and left FF sitting there on that single web page and never had a part of it visible on my desktop other than the taskbar icon).
The observed leak for the firefox.exe working set is 33,032 bytes per second. In the 23 minutes FF was sitting there in the background the working set grew by 43mb. This works out to 2.7gb per day.
I have verified this is related to JavaScript. If I disable JavaScript, and re-run the test, even with all extensions and plugins enabled, then Firefox does not leak.
There's a chance the fault is with someone like Facebook as mercurynews.com uses Facebook for their news article feedback/comment system. Even so, it would great if Firefox could limit the amount of RAM that the JavaScript subsystem can use.
I found an option, javascript.options.mem.max, but it's not documented, and it does not seem to do anything.
I did some more testing on this. I ran the same test as before where I started Firefox in safe mode for a single mercurynews.com web page and let it sit idle in the background.
Firefox 3.5.2 does not leak. Firefox 3.5.3 and all later versions I tested leak at the same rate as Firefox 5.0
I tested with 3.5.4, 3.5.6, 3.5.10, 3.5.19, 3.6, 3.6.18, and 5.0. I know all of the 4.X versions I ever used leaked.
The measurements were done using Performance Monitor (perfmon.exe) which comes with Windows. I was logging the following values for the firefox.exe process every 15 seconds: Page Faults/sec Pool Nonpaged Bytes Pool Paged Bytes Private Bytes Thread Count Virtual Bytes Working Set For the versions that leak the Working Set shows a 270,000 byte or higher increase every 15 second and Virtual Bytes jumps by 1,048,576 bytes every minute.
The behavior for version 3.5.2 is that the delta Working Set was often 0. Sometimes the working set would go up or down by a small amount such as 28,672 bytes. The delta Virtual Bytes value was nearly always 0. Every five minutes 1,048,576 bytes would get released and 30 or 45 seconds later 1,048,576 bytes gets added.
The Firefox 3.5.3 release notes at http://www.mozilla.com/en-US/firefox/3.5.3/releasenotes/ were not enlightening. As it's so easy to reproduce in v 5.0 it'll be easier to debug that version.
What I did not test was to see if versions 3.5.3 to some later version capped the increase. I know somewhere in the late 3.X series there has been no cap with people complaining about usage in excess of 1gb
Firefox for some reason eat up my pc memory when log in to hosting cpanel www.ascomsa.net/cpanel www.ascomsa.net , especially when im file manager.
I use a lot my cpanel file manager and this is a pain in the neck.
Any ideas why is happenig this or is not firefox ?