Skip to main content

Restricting Firefox's memory leak usage

There has been a lot written recently about the "memory leaks" of Firefox 1.5. The lead engineer for Mozilla Firefox, Ben Goodger posted about this over on the Inside Firefox blog.

Get Firefox!Apparently one possible "leak" is actually a feature - Firefox caches a number of the previously viewed pages in memory so that should you want to go "back" they don't have to be downloaded again.

Obviously this can be a tremendous performance boost when going back but the default rules that Ben posts abouts got me a little concerned. Here is a table of the system ram size and the default number of cached pages:

RAMNumber of Cached Pages

As you can see if you have 1GB of RAM or above it will cache 8 pages by default, but if you have 512MB then it will only cache 5. I have 1GB in my machine but will be caching the same about in memory as a 4GB machine - so I changed this setting to only cache 6 pages.

Here's how I did it:
  • On a new tab type about:config (this displays all the configuration values)
  • type browser.sessionhistory.max_total_viewers in the "Filter" box
  • By default it will be showing the value of -1 (meaning use the default value from the above table)
  • Double-click the -1, a popup box will appear, replace the -1 with 6 and click OK
  • Restart Firefox
You will now have changed the in-memory cache setting from 8 pages down to 6. If you want to cache more pages in memory then you can also make this value greater than 8 - I'm not sure of how much memory each page takes up...

Technorati Tags: , , , ,


Anonymous said…
> I'm not sure of how much memory each page takes up...

That depends on the page. Some pages use more memory than others (think large pictures etc.)...