Wednesday, February 15, 2006

About the Firefox "memory leak"

A lot of people complain about the Firefox "memory leak(s)". All versions of Firefox no doubt leak memory - it is a common problem with software this complicated. We look to fix the issues where we can. David Baron and others have done a huge amount of excellent work in this area.

What I think many people are talking about however with Firefox 1.5 is not really a memory leak at all. It is in fact a feature.

To improve performance when navigating (studies show that 39% of all page navigations are renavigations to pages visited <>

For those who remain concerned, here's how the feature works. Firefox has a preference browser.sessionhistory.max_total_viewers which by default is set to -1. When set to this value, Firefox calculates the amount of memory in the system, according to this breakdown:

RAMNumber of Cached Pages
32MB0
64MB1
128MB2
256MB3
512MB5
1GB8
2GB8
4GB8

(reference: nsSHistory.cpp)

No more than 8 pages are ever cached in this fashion, by default. If you set this preference to another value, e.g. 25, 25 pages will be cached. You can set it to 0 to disable the feature, but your page load performance will suffer.

Edit: In the comments, Boris and David pointed out that I misread the code, and that this is a global preference so that there are no more than 8 cached pages for the entire session, not per tab. My initial posting had claimed that it was per-tab. Oops!

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


Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?