Firefox Excessive Memory Usage

I like Firefox. I've even grown to like it slightly more than IE6, mostly because it has a far richer add-on ecosystem.


This is a companion discussion topic for the original blog entry at: http://www.codinghorror.com/blog/2006/03/firefox-excessive-memory-usage.html

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.

Jeff,

did you try the Firefox-safe-mode to see if any plugins you are using is causing trouble?

Take a look at
a href="http://kb.mozillazine.org/Reducing_memory_usage_(Firefox)"http://kb.mozillazine.org/Reducing_memory_usage_(Firefox)/a

They’re also talking about some know memory leaks in Firefox
a href="http://www.squarefree.com/2006/02/04/memory-leak-progress/"http://www.squarefree.com/2006/02/04/memory-leak-progress//a

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 1.5.0.1 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”)

http://weblogs.mozillazine.org/ben/archives/009749.html

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.

Marc

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?

Coleman,

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.

Scott,

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.

Jeff,

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.

Jeff,

“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.