Fixing the Firefox Memory Leak
Ever notice how surfing sessions with Firefox start out fast and slow to a crawl as Firefox eats more and more memory? Well, it took a while, but I did. As we speak, my copy of Firefox is taking up over 270MB of RAM! WTF? A little research revealed that this is due to a memory leak that was never fixed. Here's a list of things you can do to minimize the problem:
- The first course of action is not a change in settings, rather the first thing you should do is check this list to see if any plugins you have installed are on them. In my case, I was running the official copy of the Google Toolbar, which has a known memory leak. This is most likely the true source of my memory problems, not the browser itself. I was able to uninstall the official Google Toolbar and install the unofficial Googlebar as well as a PageRank addon , to make up for the fact that the unofficial Googlebar doesn't show PageRank. By the way, I installed these separately instead of using the combined PRGoogleBar because the Googlebar project seems to be more up to day in terms of development.
- Start tweaking settings. By default, browser.sessionhistory.max_total_viewers is set to -1, which means that Firefox will try to determine a good value based on the total amount of RAM you have in your system. The following table shows what value Firefox will choose based on your total RAM:
32MB 0 64MB 1 128MB 2 256MB 3 512MB 5 1GB 8 2GB 8 4GB 8 I have 512MB of RAM in my Laptop/Tablet PC system, so Firefox would choose a value of 5. The higher this value is, the more memory Firefox will consume when I use alot of tabs at one, which I do often. Lowering this value causes less memory to be used but also causes more previously visited pages to have to be re-parsed (thus increasing their load time). I decided to hardcode this to 2 instead. A value of 3 may be a better idea, but I want the effects of these changes to be as clear as possible. By the way, you can access these settings by typing "about:config" into your address bar, without the quotes, and pressing Enter.
- There are other values that could be adjusted like browser.cache.memory.capacity and config.trim_on_minimize, but the former already has a pretty small value, and the latter only takes effect while Firefox is minimized, which isn't good enough for me.
Well, that's it. Good luck. Be sure to post a comment and let me know how it went.


