3 Steps You Can Take To Reduce The Firefox 4 Memory Leak

firefox memory leakSince the introduction of Chrome and the advancement of Internet Explorer to version 9, Firefox has been losing ground rapidly. Innovation is lacking and problems are amassing. One major issue is that Firefox 4 swallows up more RAM than any other version before it. Its memory usage has become almost abusive and working with a browser that turns your computer into a snail is no fun.

If you are looking for ways to tame the beast, I may have some clues! In this article I will show you 3 steps to reduce and limit the chunk Firefox bites off your RAM. I will start with the obvious, but in the last step, we will dive deep into the heart of your browser.

Prologue

I have been using Firefox for many years and have carried over my profile from each version and computer to the next. Over the years, I have accumulated hundreds of bookmarks, dozens of extensions (most disabled), and several plugins. So by version 4, Firefox has grown to a respectable size. You could call it a monster.

To show you that the tips I’m sharing do have an effect, I have documented how memory usage improved on my machine as I went from one step to the next. Unfortunately, I found that Firefox leaks memory, thus I recorded the value after a few minutes, even though in all cases it continued to increase. This is not 100% exact, but it still gives you a good idea of how well each step works.

Counting: 29 open tabs, 31 extensions

State of affairs: 700,740K

firefox memory leak

1. Close Or Hibernate Tabs

In case you didn’t know this already, the outrageous amount of memory Firefox uses, correlates with the even more outrageous amount of open tabs you cannot get yourself to close. Unfortunately, the easiest way to save a lot of RAM, is to close a lot of tabs.

If you cannot close all of them for the love of it, how about managing your tabs with the help of one of the following extensions:

  • BarTab
    Loads a tab only when it is visited and lets you unload tabs from memory either manually or automatically.
  • Memory Fox
    Fixes Firefox memory leaks and releases RAM.
  • Load Tabs Progressively
    Limits the number of concurrent loading tabs. Similar to BarTab.
  • TabGroups Manager
    Allows you to organize tabs in groups and hibernate groups, removing them from memory.

Personally, I work with TabGroups Manager. The extension helps me to keep the amount of open tabs at bay, and this is how I could remove 13 tabs from memory all at once.

For more about tabs, see this article: The 5 Best Firefox 4 Addons For Tabbed Browsing.

firefox memory hog

Counting: 16 open tabs, 31 extensions

Memory usage: 496,860K

2. Remove Add-Ons

Running add-ons, i.e. extensions, themes, or plugins, eat up quite a bit of RAM. So go through your collection and remove those that you never use. Before entirely removing them, you can disable them and see whether that significantly improves the memory leak. Go to > Firefox > Add-ons and switch between > Extensions > Appearance and > Plugins. Be sure to update them via the > Tools for all add-ons button.

firefox memory hog

Counting: 16 open tabs, 21 extensions

Memory usage: 443,916K

3. About:Config Hacks

There are several very potent hacks that control how much memory Firefox can or will use. None of them had a huge effect in my demonstration, but your results may vary.

Limit Firefox’ RAM usage

Type > about:config into the URL bar, promise to be careful, and scroll to > browser.cache.disk.capacity. The default value depends on how much RAM you have installed. Double-click it to change the value. Do not limit the RAM usage too aggressively, especially not below the amount of RAM Firefox is using as you apply this hack, so be sure to check first! In my case around 400,000K was a realistic value.

firefox memory leak

Allow Windows to Claim Back RAM when Firefox is Minimized

With this hack enabled, Windows will be able to claim back RAM more aggressively. In > about:config right-click anywhere and select > New > Boolean and enter > config.trim_on_minimize as the preference name. Double-click the new entry to set its value to > true. Restart Firefox to enable the changes.

firefox memory leak

Limit Memory Storage for Open Tabs

The last about:config preference we are going to look at is > browser.sessionhistory.max_total_viewers. The default value is -1, which will automatically determine the maximum amount of pages stored in memory, based on the total amount of RAM. In other word, the bigger your RAM and the more tabs you have open, the bigger the chunk that Firefox will take. You can set this value to zero to not store any pages in memory or to 1 for 32MB, 2 for 64MB, 3 for 128MB etc.

More information about this preference can be found in the mozillaZine. I went with 3 for 128MB.

Status: No change in tabs or add-ons, all hacks applied.

Memory usage: ~400,000K (maximized) and ~350,000 (minimized)

Epilogue

All steps brought some improvement, but the end result was still not very satisfying. Besides, the real problem with Firefox 4 is the memory leak, which in my case was mainly caused by open tabs. Firefox’ memory usage would climb on and on with no way to stop it, other than to close all tabs. When I closed all tabs except for one, Firefox used about 230,000K. With a virgin profile, memory usage went down to around 48,000K; finally a realistic value, but sadly with almost every little bit of customization removed.

Status: virgin Firefox profile, 1 tab open

Memory usage: ~48,000K

The conclusion is that Firefox has a problem, but if you love your open tabs and add-ons, you will have to put up with it. If you prefer a lean and fast browser however, simply ditch everything, create a new profile, and be very restrictive with what you add.

Finally, you may also want to try the tips from this article: 5 Things To Do When Firefox Runs Slow But Other Browsers Run Fast.

So what are you going to do? Hold on to your stuff or browse lightly?


MakeUseOf Recommends

Tina Sieber

Tina is a freelance writer, editor, natural scientist, and cosmopolitan with a strong interest in sustainability. She has been writing for MakeUseOf since late 2007 and also is the Editor for MakeUseOf Answers.

The comments were closed because the article is more than 180 days old.

If you have any questions related to stuff mentioned in the article or need help with any computer issue, just ask it on MakeUseOf Answers.

Hide 44 Comments

  • Chromed June 17, 2011
    0 likes

    Why does anyone need 29 open tabs and why bash firefox for this? Keep 29 tabs open in any other browser and see what happens

    | Like
    • Anomaly June 17, 2011
      0 likes

      Agreed. Try opening 29 tabs and install 31 extensions in Chrome and you will see what a pig is all about. Just imagine what Task Manager would like like if you did that in Chrome.

      I agree that Firefox uses more memory with every release but so do all other browsers. Opera’s memory usage has also sky rocketed with the last few releases. Chrome though is by far the worse of them all and it’s the browser Firefox bashers recommend as a replacement which is just ridiculous.

      | Like
      • Tina June 17, 2011
        0 likes

        People who work on multiple projects in parallel like myself find it very convenient to have multiple tabs open, rather than bookmarking and re-opening whenever switching between projects. Personally, I do try to keep the number of tabs in each browser (I do use Chrome, too) below 20, but it’s tough.

        | Like
        • Anomaly June 17, 2011
          0 likes

          I understand why you have many tabs open. I’m just saying if you had 29 tabs opened and 31 extensions installed, like you mentioned in your article, you would have a memory issue with most browsers. Since Chrome puts each open tab and extension in a separate process you would really have a memory issue using Chrome.

          | Like
          • Tina June 17, 2011
            0 likes

            True. But Chrome has less of a memory leak issue.

            | Like
          • Joshua June 20, 2011
            0 likes

            Chrome’s extensions are merely scripts, they lack functionality and performance. The cost of RAM is so cheap, rather than sacrificing the functionality and performance of your extensions.

            Why is memory even a concern? I currently have 6GB and never worry
            about my memory usage, so what if Firefox is eating 800MB. I even have pagefile disabled and even with Firefox running and playing intensive games; I have yet to experience
            any problems. Checking memory usage I rarely see above 50% of my memory being used.

            If you’re concerned with memory, spend $160 and get 16GB…  You can get 4GB of DDR3 for less than $40 bucks, or 8GB for less than $80.

            | Like
  • gaiamie June 17, 2011
    0 likes

    re open-tab clutter: some of us don’t have high speed at home, so we keep 29…39…49 tabs open on a regular basis, because that way we can read content offline, after pulling it up at wifi spots in town.  it’s the sad state of rural california, but someday we will join the ranks of europe, east asia and elsewhere with actual widespread coverage.  believe it or not we still have dial up! 

    | Like
    • Tina June 17, 2011
      0 likes

      That sounds quite frustrating.

      | Like
      • Saptashwa June 17, 2011
        0 likes

        Supposedly broadband connections in India have max speeds of about 200KBps. That’s frustrating.

        | Like
        • Tina June 17, 2011
          0 likes

          Definitely is.

          | Like
    • Saptashwa June 17, 2011
      0 likes

      Then what do you say of India? My unlimited broadband connection was recently capped to 50KBps. Now, this is frustrating.

      | Like
  • GeoffP June 17, 2011
    0 likes

    My Firefox memory usage topped 2,000,000KB recently, forcing
    me to search for a solution. FF4 is far worse than FF3, where the same
    extensions and tab bloat would not use 1/4 of that. Disabling dev extensions
    like Firebug has significantly reduced the problem for me. As for those ‘reclaim
    memory’ tools, see http://www.howtogeek.com/62301/htg-explains-do-firefox-memory-cleaners-actually-work/.

    | Like
    • Tina June 17, 2011
      0 likes

      Thanks for the link, that’s a great article!

      I actually wonder now what made me included Memory Fox where I did. It doesn’t manage tabs. Alas the essence is, the only thing that really works is closing tabs and getting rid of extensions. The user cannot really fix the memory leak.

      | Like
  • kioshi June 17, 2011
    0 likes

    You should compile some list of the most ‘power hungry’ extensions. I”m not sure adblock and stumbleupon are hogs but I suspect they are.

    | Like
  • Shawn Adam June 17, 2011
    0 likes

    Something that I use that greatly reduces the memory usage is FireFox Ultimate Optimizer.  It runs in the background and reduces usage to about 2,000 K, and whenever the memory starts to climb again, it reduces it again.  I have been using it since FireFox 3.5, and it still works even with FireFox 5.0.

    http://www.ghacks.net/2008/01/12/firefox-ultimate-optimizer/

    | Like
  • Karthik Prabhu June 17, 2011
    0 likes

    Limiting Firefox’s memory usage and also hibernating certain tabs helped reduce the memory consumption to some extent. But, the memory leak really needs to be fixed in order to see a significant improvement.

    | Like
    • Tina June 17, 2011
      0 likes

      That was my conclusion, too.

      | Like
  • Anomaly June 17, 2011
    0 likes

    The problem with Firefox is that it doesn’t seem to release the memory after you close a tab. I have noticed this much more in recent versions.

    | Like
    • Saptashwa June 17, 2011
      0 likes

      True.

      | Like
    • Tina June 17, 2011
      0 likes

      Another good point. I restarted Firefox after every step, so I didn’t look into what happened when I just closed tabs without removing Firefox from memory.

      | Like
  • Greg June 17, 2011
    0 likes

     MemoryFox isn’t working at all, please read this article – http://www.howtogeek.com/62301/htg-explains-do-firefox-memory-cleaners-actually-work/

    | Like
    • Tina June 17, 2011
      0 likes

      Thanks Greg. Someone else also pointed this out. I put it under tab management and I admit that was a mistake in the first place.

      | Like
  • Bogdan June 17, 2011
    0 likes

    I think it’s more about the OS and how you use it than the actual browser.
    Just as a matter of fact, I’ve discovered that Firefox is much more responsive under Linux than Windows or Mac.

    | Like
    • Tina June 18, 2011
      0 likes

      You could be right. I never tested that.

      | Like
  • B N June 18, 2011
    0 likes

    I’ve used the portable version of firefox to limit the amount of ram it uses, but now I just use cometbird which still has that ram leakage issue (it’s basically firefox but with some changes that make it a bit faster with the same ram usage that firefox uses).

    | Like
    • Tina June 18, 2011
      0 likes

      Good idea using the portable version!

      | Like
  • Anonymous June 18, 2011
    0 likes

    Mozilla recently released a list of slow-performing add-ons here:

    http://addons.mozilla.org/en-US/firefox/performance/

    but a separate list of memory-hogging add-ons would be useful as well. In fact, you know what would be a really great extension? An extension that flags which of your other extensions are memory hogs.

    Firefox 4 definitely appears to have a serious, progressive memory leak, at least in conjunction with the extensions *I* use. The only solution that works reliably for me is to exit and restart Firefox from time to time. (For what it’s worth, I automatically delete the cache every time I exit, in case cache corruption is contributing to performance slowdowns.)

    Believe it or not, I’ve found Google Chrome to be a *much* worse performer than Firefox on low-memory (1GB RAM) systems when more than a few extensions have been installed and more than a few tabs are open. With ample RAM, Chrome catches up and may even overtake Firefox — though not enough to make me want to switch to Chrome as my default browser.

    Finally, I get the sense that Pale Moon — a special Firefox build for non-legacy CPUs only — loaded with the same extensions, doesn’t have quite as bad a memory leak problem as Firefox proper. It seems to me that my Pale Moon sessions can go longer before the browser bogs down and I’m forced to restart. But I’ve never done a systematic comparison, so my impression should be taken with a grain of salt…

    | Like
    • Tina June 18, 2011
      0 likes

      Thanks for sharing!

      | Like
    • Anonymous June 20, 2011
      0 likes

      I forgot to mention that for some time now the MozillaZine community has maintained a list of “problematic extensions,” here:

      http://kb.mozillazine.org/Problematic_extensions

      Memory leaks are expressly noted as a problem in a few instances.

      | Like
  • Keith Riggle June 18, 2011
    0 likes

    The about:config browser.cache.disk.capacity setting limits the disk cache size, as the name suggests, and has no direct effect on RAM. Try adjusting the browser.cache.memory.capacity setting instead. The default is -1, which is supposed to automatically adjust the amount of RAM used to cache “decoded images, messages, and chrome based on the total amount of RAM.” I changed it to 30720 kb, based on my 4 GB of installed RAM, and the amount of RAM used by Firefox was reduced. See http://kb.mozillazine.org/Browser.cache.memory.capacity for more details.

    | Like
  • Tina June 18, 2011
    0 likes

    Keith, thanks for pointing this out and sharing an alternative!

    | Like
  • GeoffP June 20, 2011
    0 likes

    I just installed Firefox 5 and memory usage has halved (same tabs and extensions, except no Google Toolbar for now). It’s back to FF3 levels.

    | Like
    • Tina June 20, 2011
      0 likes

      Interesting.

      | Like
  • Jae V. June 20, 2011
    0 likes

    At most I have 4 tabs open when I work, 2 extensions enabled, and Firefox is still a big leaker.  The new v4 has not made me a happy camper.  I’ve never had to configure this much to get it to play nice.  Thanks for the edits.  I’ve changed settings and we’ll hope for improvement!

    | Like
  • Dick June 22, 2011
    0 likes

    Perhaps it exist one more solution? For example to use another browser than FF4? I mean to delete FF4 and problem will be solv?

    BTW, it will be nice if Windows have that future to warn in real time about softwares which use so much memory, so users will know, where is the problem.

    | Like
    • Tina June 23, 2011
      0 likes

      Which browser do you suggest?

      | Like
  • MikeH June 24, 2011
    0 likes

    I have 4 identical sites opened in Chrome 5, IE9 and FF5, and the memory usage in the same order is 71MB, 76MB and 280MB (and climbing). So still seems to be some memory related issues. A leak is definitely happening as the number keeps climbing even with no use of the browser. Not a good sign in my view.

    | Like
    • Tina June 24, 2011
      0 likes

      Mike,

      Chrome runs multiple processes, one for each tab and one for each extension. Did you add up all the processes in terms of memory usage for Chrome?

      Either way, you’re right about the leak, it’s pretty obvious that something is awfully wrong there.

      | Like
  • Tim June 26, 2011
    0 likes

    I have a little utility called CleanMem installed on my computer.  It comes with a memory monitor that periodically dumps unused junk from RAM.  I find that it does an extremely good job of taming Firefox’s RAM usage as well.  I have Firefox open 24/7 and it’s never crashed on me.

    | Like
  • Guest July 21, 2011
    0 likes

    Although it’s yet another add-on, if you want to read pages offline you should try the Read It Later extension. Not only does it allow you to “bookmark” pages without cluttering your bookmarks menu/folder, but also allows for a text-only view of articles you’ve saved. Highly useful for sites that don’t have a print-friendly setting or that inject advertisements in their supposedly “print-friendly” view.

    Be a shame if AdBlock Plus is a memory cannibal. I use it (and Element Hiding Helper) all the time along with several other privacy extensions (Better Privacy, Beef Taco, Web of Trust, and HTTPS Everywhere). IMHO HTTPS Everywhere’s functionality should be a built in option (allows you to use SSL on any/all sites that support it), but so should AdBlock’s and Beef Taco/Better Privacy (blocking/deleting cookies/setting permanent opt-outs).

    Also, what is this “plugin container” that keeps opening up all over the place? Sometimes there are at least six of them depending on how long I’ve been online. I read it has something to do with Flash and JS but I’m worried it may be some sort of replicating virus considering how many copies of itself it opens automatically. FF goes up to sometimes half a gig of memory when this thing is open — am I in danger of something or is this “a feature, not a bug”?

    | Like
    • Tina July 22, 2011
      0 likes

      Where do you see the plugin containers? This sounds like a question for MakeUseOf Answers.

      | Like
  • Marcel July 27, 2011
    0 likes

    Another rather useful tool against FF’s memory leak is Firemin (http://www.rizonesoft.com/2011/firemin/) – The current version apparently won’t work if your Firefox is in a different folder than the default one though. The developers mentioned working on that issue, so guess in a future release it’ll be fixed.

    | Like