Firefox 3 Memory Usage(March 20, 2008)
Stuart Parmenter has blogged about the memory usage in Firefox 3
and the significant changes to the platform. He talks about the reduced
memory fragmentation, adjusted stored image data and more.
- Reduced Memory fragmentation - the number of total allocations is minimized to avoid unnecessarily churning memory; allocations in almost all areas of the code base are reduced.
- Fixed cycles with the Cycle collector - for Gecko 1.9 is implemented an automated cycle collector that can recognize cycles in the in-memory object graph and break them automatically.
- Tuned caches - cached documents are now expired in the back/forward cache after 30 minutes since users likely won't be going back to them anytime soon. There are timer based font caches as well as caches of computed text metrics that are very short lived.
- Adjusted stored image data - In Firefox 3, thanks to some work by Federico Mena-Quintero (of GNOME fame), the uncompressed data is thrown away after it hasn't been used for a short while. Another fantastic change from Alfred Kayser changed the way we store animated GIFs so that they take up a lot less memory. Firefox 3 now store the animated frames as 8bit data along with a palette rather than storing them as 32 bits per pixel.
Looking at the graph:
- All browsers increase in memory use slightly over time, but the Firefox 3 slope is closer to 0.
- The _peak_ of Firefox 3 is lower than the terminal size of Firefox 2!
- The terminal state of Firefox 3 is nearly 140MB smaller than Firefox 2. 60% less memory!
- IE7 doesn't appear to give any memory back, even after all the windows are closed!
- Firefox 3 ends up about 400mb smaller than IE7 at the end of the test!
- Firefox 3 beta 4 is significantly smaller than previous versions of Firefox and other browsers.
- Users can keep the browser open for much longer using much less memory.
- Extensions are much less likely to cause leaks.
- There are automated tools in place to detect leaks that might result from new code.