March 13, 2006
I like Firefox. I've even grown to like it slightly more than IE6, mostly because it has a far richer add-on ecosystem.
But I have one serious problem with Firefox:
This screenshot was taken after a few days of regular Firefox usage. That's over 900 megabytes of memory for a single, non-tabbed instance of Firefox.
What's going on? Well, according to my tests, Firefox never seems to release any of the memory it uses-- until you close all instances of Firefox. If you spend enough time browsing the web, and never close Firefox completely, you'll consume nearly a gigabyte of memory!
Because I often keep at least one browser window open for research or reminder purposes, this bites me a lot. I'll look at Task Manager and Firefox will regularly be gobbling up over 400 megabytes. This isn't uncommon. It's normal.
I don't ever recall having this problem with IE 6.
Of course, I can close all instances of Firefox and reduce memory usage back to zero, but why should I have to? I've read this techweb news article on the controversy around Firefox and memory usage, and I've implemented the workaround suggested in that article:
- Within Firefox, enter "about:config" (minus the quotation marks) in the address bar
- Scroll down to the entry "browser.sessionhistory.max_total_viewers" and double-click it.
- In "Enter integer value" field, type..
- "0" to disable the cache
- "1" through "8" to set the maximum cache as 1 through 8 previously-viewed pages
- "-1" to return the cache to its default
Sadly, this fix did very little to address the problem. The above screenshot was taken after setting that value to 1!
Posted by Jeff Atwood
Okay, I uninstalled all of my plugins. I had 3 installed; "Open in IE tab", "Extended Status Bar", and "XPath Checker". The only culprit I found to use unusual resources was the "Open in IE Tab", which apparently started 1 or more threads at startup. Firefox still uses up to 25 MB of RAM at startup, though.
did you try the Firefox-safe-mode to see if any plugins you are using is causing trouble?
Take a look at
They're also talking about some know memory leaks in Firefox
I have firefox (1.5) running near continuously and the memory footprint hovers around 100 meg. The plug-in theory is worth checking out.
I also cant't win the fight for memory with Firefox. The solution I use is Tab Mix Plus extension which has session saver and I restart FF in some intervels.
I filed a few bugs on memory consumption back in the day; back in the 1.0 era FF had gaping memory holes around images, and every 10 minutes browsing deviantart was another 100 megs used, even if it's mostly paged out after a while. 1.5 is much kinder on the ram, but still full of small leaks, especially images. I wish someone would run serious code coverage tools on it to diagnose and fix them, and simply make it impossible for extensions to use too much memory. (I've been guilty of making one that ate memory myself, once.)
It's nice to see that the problem is being addressed, at least, Thijs.
I have found Firefox to be remarkably trouble free since I started using Opera as my main browser. I realise that Browsers are all about religion and not functionality but it does all the better-faster-lighter stuff just like people say it does and I only go back to Firefox now because the Web Developer Toolbar is great for live CSS editing.
Target system issues? I'm using 188.8.131.52 on Linux 2.6.15 with a few kernel patches, mostly revolving around latency reduction. Firefox, right now, has two tabs open on Gentoo's installation guides, one on Coding Horror, twenty one El Reg, two on Stallman's site (*) and, just for the Hell of it, I opened four random webcomics whose front pages are image-heavy to various extents. Firefox is currently chewing a something in the region of between sixty and eighty megabytes. Perhaps it's just that Mozilla's code monkeys are a lot more practiced at developing under Linux's memory models than Windows' one? Firefox on this Linux box does also leak memory while browsing, but at a much, much lower rate than the same version on Windows (on the same box, similar if not identical extensions installed).
(* Honest, I have a non-pathetic reason for visiting that site! Specifically, I'm looking for information on how to kidnap people with huge beards).
One thing that you can try is to add the key config.trim_on_minimize with a value of boolean true to about:config. This causes Firefox to release its working set when you minimize it. This usually allows me to minimize Firefox and restore it to take care of those times when it bloats uncontrollably.
Target system issues?
You can find similar reports for Linux if you read through the original thread (just search for "Linux")
I suspect the people that haven't run into this tend to close their browser completely at least once a day or every other day.
If you leave at least once browser instance running, I guarantee you'll run into this after a few days of normal browsing. When I came into work today, Firefox.exe was using 400mb. This is pretty typical..
I've set browser.sessionhistory.max_total_viewers to zero, and browser.cache.memory.capacity to 65536 (not sure if it's related), and I haven't been seeing any of these memory issues.
Why the high number of page faults? According to the task manager help, this is the number of times the process had to read information from the disk. Why would firefox be hitting the HD so much?
Probably because it's using 900 frickin' MB of RAM. Also,it keeps up to 8 pages cached in memory for each tab. That's the explanation given by the Firefox devs. It's not a bug, it's a feature!
I've got my sessionhistory set to 0, so it fetches each page fresh rather than hitting the cache. But I still return each Monday morning to work a find a "your virtual memory is low" warning dialog when I leave Firefox open.
8 pages cached per tab? Jeez. That should be configurable.
I added the browser.cache.memory.capacity and the config.trim_on_minimize keys to about:config. The config.trim_on_minimize seems to really help.
Overall, though, by looking at Peek Mem Usage and Mem Delta, FireFox appears to just be super memory intensive. At startup, it went to 25 MB of RAM and almost 9K page faults and 11 threads! That's for 1 tab, which is the Google home page. However, simply opening a new tab didn't consume any additional RAM. That only happened when I opened a page in the tab.
However, to be fair, those startup stats are almost identical to what IE6 does. IE6, though, automatically does the config.trim_on_minimize trick, though.
Geeze and the single biggest complaint that keeps me from running firefox long enough to find these sorts of problem are how long it takes to start up.
It astonishes me how long Firefox takes to startup. When I want to browse, I want to browse NOW. I open and close my windows constantly, and having that wait (albeit brief, but still longer than any other app I have except Delphi) injected EVERY time I start it up again is annoying and frustrating.
Maybe it's preallocating the 900mb of ram...
I'll be the second one to suggest Opera, a great browser which doesn't leak memory like celebrities leak home videos. Or Firefox. Not home videos, memory.
Opera might not have all the developer extension bells and whistles like Firefox does, but for actually browsing the web, it's awesome (plus, it tends to catch non-standards-compliant JS errors more than any Gecko browser does).
In fact, it makes me giggle when I see people installing yet more memory-leaking extensions to duplicate some of Opera's built-in functionality - *giggle*.
P.S. My Opera is currently using 67 MB of memory with 17 pages open.
When I began to work with .NET I have been fooled by a very *high* memory consumption reported by task manager, using managed application.
I realize this happened *before* garbage collection. GC can be triggered by minimizing the application (Just try with Visual Studio for example).
When GC has occured, hundredfolds amount of memory are released.
This is not applicable to FF, but this gives a good example about how benefit garbage collection could be.
Anyway, I would be that a bug is causing this memory leak, rather than a design flaw.
Any chance it's actually Flash that's causing the problem? I saw the same thing and disabled flash.
Since you leave your browser open, enable the config.trim_on_minimize option in about:config. That way, when you minimize (you do minimize don't you?), Firefox will free memory. I'd be interested to see if in your case if Firefox will go back up to 400 MB used or whatever.
"Sadly, this fix did very little to address the problem. The above screenshot was taken after setting that value to 1!"
I tried setting it to one and still had some issues. Try setting it to 0. I did that and I haven't had seen mem usage over 250MB. It's the band-aid-on-a-sucking-chest-wound fix.
Firefox on Windows is really bad, the Linux binaries don't seem to have problems like this, or at least not as terrible as the Windows versions.
As I was reviewing the comments, I must have missed the answer to the original question Thijs put forth: "did you try the Firefox-safe-mode to see if any plugins you are using is causing trouble?"
Some add-ons, such as AdBlocker, had known memory leaks that have already been fixed.
Open up your extenstions list and click the button labeled "Find Updates". Update every single extension if you can. I find that FF never gets the latest versions of any of my extensions, even though I told it to automatically check for updates.
There is a *much* better solution to Firefox: SeaMonkey.
Brief history: When firefox was pre-1.0 it was alawys assumed by the MoFo that all the old Mozilla devs would 'switch over' to Firefox when it became "stable"; that they were only 'maintaining' Mozilla 1.7 and perfecting Gecko (which firefox uses for rendering).
Well, after it went 1.0 the MoFo devs looked at the 50,000 known at the time (seriously) memleaks, lack of structured planning, lack of coding standards, etc. and went "what a piece of trash." Not a single MoFo dev stayed. Instead, over time they developed SeaMonkey which is now very very stable.
SeaMonkey has virtually every single feature of Firefox (including extensions and support for a great many Firefox extensions) but NONE OF THE DOWNSIDES. It is developed by the same people that develop the Gecko rendering engine and they are far more professional coders to boot. I know; I have reviewed both FF and SM codebases.
For more information, see my research study Firefox vs SeaMonkey vs Mozilla vs IE vs Opera (a href="http://www.incendiary.ws/node/177)."http://www.incendiary.ws/node/177)./a Since then, SeaMonkey has improved while Firefox has continued to leak.
why is this???
When I go to this URL : about:cache?device=memory
Then I see some of the GIF images normally taking up 1Kb reserving a space of 250000 bytes
Data size: 250000 bytes
Fetch count: 1
Last modified: 2006-04-26 21:10:52
Expires: 2006-04-28 15:46:41
Data size: 313720 bytes
Fetch count: 15
Last modified: 2006-04-26 14:37:58
Expires: 2006-05-02 01:11:04
Why is the data size so huge?
Or are they counting the bits? :D
What could be the prob with that?
setting the following to 0 seems to work well...
mine floats around 60mb with about 10 tabs open, most of them containing ajax/c-panel pages (constantly updating stats...)
the minimize function seems to help masses... knocks it down to around 50mb but then it creeps up again.
oh... anybody noticed that as soon as you open a java applet your mem jumps up by about 200mb???
This type of thing has been happening with Firefox forever with me, whether I have add-ons or not (I think). I am surprised I've been putting up with it for that long, and I am getting motivated to find something else. I too have had to keep seeing the "Virtual Memory Low" warning from Windows, and I have 512 Meg here. More oddly, I very often find that even though all Firefox windows have been shut, a Firefox process is still shown running, often at rather high memory, in the Task Manager. My computer is whirring dealing with the memory, and as soon as I close that phantom Firefox process all returns to normal. IRRITATING.
SeaMonkey, as the other poster said, might be better based on his stats (though I thought it looked very like a return to 1999 Netscape-ville). I am now just trying out Opera. I'm already annoyed that they ignore Fitts Law and put the all important back button with an annoying 20 pixel or so border to the left of it so that you can't just mouse to the hard left of the screen and push the button--dumb!!
That issue is freaking me out. All those workarounds wasnt good for me. If I had to remove plugins, why am I using Firefox ? Firefox is good because its customizations that came from plugins.
If wasnt some exclusive plugins I would be using Opera whole time.
TIP-how to minimize your firefox memory usage
1. On the website url toolbar type about:config
2. A page full of words will come up. right click anywhere and choose New - Boolean
3. For the name input type config.trim_on_minimize
4. Select True
5. Restart FireFox.
6. Ctrl + alt + del (this opens your task manager)
7. Go to process and choose your Firefox process (usually called firefox.exe)
8. Look at the Memory Usage Column (average is 20,000-40,000)
9. Now minimise firefox and you will see the memory usage to be less than 10,000
I was testing this on my 3ghz cpu, 2gb ram, HP machine. I have been noticing this incredible lag for days. So I did some testing. When I am using FF I always have my gmail open and an igoogle page. Those are two tabs that are essential for me. Well, what I found was that when I was using the NEWEST version of GMAIL my CPU usage was hitting 50% plus pretty consistently and the MEM usage ranged from 105k to 210k. BUT when I switched to the OLDER version of GMAIL and left it open my CPU usage bottomed out and only spiked when I opened new tabs or emails in GMAIL. MEM usage stayed around 120k pretty consistently as well without ranging too much in the upper register. I can't believe that Gmail is such a culprit in this little affair though. I'm surfing much smoother now. Give it a try. Try switching from the newer and older versions of gmail with the task manager opened. you'll see a crazy difference.
I'll third (fifth, ninth, whatever) the call to point the finger at plugins.
I have a situation where firefox is eating memory even when I don't do anything. Sometimes (and it's unfortunately not reproducable on demand) I'll leave firefox running with no loaded page and go home for the night. In the morning, I'll find that firefox memory usage has balooned to over 500MB. Without any user doing anything! (So obviously it's not the 8-cached-pages "feature" that the mozilla folks are talking about.)
But then, I did as people suggested and uninstalled all my plugins and over the course of two weeks, firefox memory usage behaved. I then put all my plugins back in and the problem resurfaced.
Now, I run over a dozen plugins so I haven't bothered to install them one at a time and try to find out which one is the problem. I just shut down firefox at the end of each day.
So, I think that the real bug report to file with mozilla is that they need to put in place some sort of limits and checks on plugin memory usage.
I am not having these problems at all on a Windows install at all.
What extensions are installed? With that amount of memory used, I would say there is a pretty good probability you are just using an extension that leaks memory. That "add-on ecosystem" has a downside. Start Firefox in safe mode and reproduce this, or figure out what leaky add-ins are causing this.