Pages

March 29, 2014

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



I have found Google Chrome to be a memory hog on a variety of computers using Windows and Linux. So am back to Firefox for now. Firefox uses less CPU and memory than all the current browsers. Below is an article to make Firefox even faster by using even less memory. Enjoy.

Since 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


FirefoxMemoryUsage01   3 Steps You Can Take To Reduce The Firefox 4 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.


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


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.

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

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.


FirefoxMemoryUsage04   3 Steps You Can Take To Reduce The Firefox 4 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.

FirefoxMemoryUsage05   3 Steps You Can Take To Reduce The Firefox 4 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?

Source: http://www.makeuseof.com/tag/3-steps-reduce-firefox-4-memory-leak/