mozdev.org

Firefox Memory Usage FQA

Contents [Skip]

About This FQA

Introduction

Firefox memory usage has been quite a hot topic since the release of Firefox 1.5. This FQA is designed to provide you with tips on how to minimise the amount of memory Firefox uses, information on what is known to cause memory leaks in Firefox, what is and isn't a memory leak, progress on the fixing of memory leaks and ways you can help.

FQA Notes

FQA stands for "Frequently Questioned Answers", which is very fitting for this subject...

Acknowledgements

The information and solutions in this thread have been sourced from various users and threads, and the MozillaZine knowledge base.

Special thanks to: Jesse Ruderman Steve England Fellow old timer schapel

Themes, Extensions, Plugins

Themes & Extensions

Themes and extensions can cause memory usage to increase significantly. Try running Firefox in Safe Mode to see if it is a theme or extension causing your problem. See also Known Leaky Extensions.

Adblock

Using old versions of Adblock with Firefox 1.5 is a bad idea in general, and has been reported to cause increases in memory usage. Firefox 1.5 users should use AdBlock Plus or upgrade to Adblock 0.5.3.042. If you have not installed Firefox 1.5 yet, uninstall Adblock and restart Firefox twice before installing Firefox 1.5.

Fasterfox

The Fasterfox extension has a feature that enables prefetching of all static links in the page you are viewing ("Enhanced Prefetching"). This is off by default. Whilst switching this on can decrease the amount of time taken to load pages (because it fetches them before you attempt to view them), it will also increase memory usage.

Firefox Preloader

Using the Firefox Preloader will increase memory usage. Disabling it if you do not need it will save memory. (Yes, I know this behaviour is by design...)

Plugins

Some browser plugins, particularly Adobe Reader and Java, can use large amounts of memory. Since plugins are not unloaded after use, restarting Firefox can help.

Java

Java users should update to Java Runtime Environment 1.5.0_07. Turning off the Java Console using the Java Control Panel may also reduce memory usage.

Adobe Reader

Adobe Reader 6.0, and to a lesser extent 7.0, can use large amounts of memory. Upgrading to Adobe Reader 7.0.8 can help reduce memory usage. Disabling unused Adobe Reader plugins can help too.

Firefox Tweaks

Firefox Memory Cache

By default, Firefox does not use a fixed size memory cache - it uses a percentage of system memory. Setting a fixed size memory cache can often reduce memory usage - 4 or 8MB is sufficient in most instances. To set a fixed size memory cache, add the following pref using about:config:

browser.cache.memory.capacity

This is an integer pref, and can be set to the size you want the cache to be (in kilobytes).

There has been some debate about how Firefox sets the memory cache size. See bug 105344, bug 204164 and bug 296538 for various discussion about this issue.

You can also disable the Firefox memory cache completely, however this is not recommended. To do this set the following pref to false using about:config:

browser.cache.memory.enable

Memory Usage Upon Minimize

There is a pref that enables trimming Firefox memory usage when you minimize all Firefox windows. This pref is for Windows only. To enable it, set the following pref to true using about:config:

config.trim_on_minimize

Fast Back/Forward

Firefox 1.5 has a new fast back/forward feature (bfcache) that vastly reduces the amount of time taken to display pages when the back/forward buttons are used. This adds to memory usage. To disable this, set the following pref to 0 using about:config:

browser.sessionhistory.max_total_viewers

You can also control the number of pages stored instead of disabling it entirely, this is documented in the MozillaZine Knowledge Base. Note that the amount of memory used will vary according to the size and content of pages.

Browser History

Setting the browser history to extremely large values will increase memory usage. Keeping the history to a reasonable level is a good idea for this reason.

Download Manager

Clearing out the list of downloaded files every so often will reduce memory usage.

Other Issues

JavaScript

Pages with lots of (or bad) JavaScript can increase memory usage. Using NoScript to control when sites can use JavaScript can help in this situation.

Profile Corruption

Profile corruption can cause all sorts of strange behaviour, including increasing memory usage. If you suspect your profile is corrupted, or none of the other suggestions work, you can try creating a new profile.

Bugs & Fixes

Fixed in Firefox 1.5.0.5

Note: Firefox 1.5.0.5 has not been released at this stage.

Fixed in Firefox 1.5.0.4

Fixed in Firefox 1.5.0.3

Firefox 1.5.0.3 is a security only update, with no memory leak bugs fixed.

Fixed in Firefox 1.5.0.2

Fixed in Firefox 1.5.0.1

Fixed on Gecko 1.8 Branch

Fixes on the Gecko 1.8 branch will be included in future Firefox releases from that branch, such as Firefox 2.0. These fixes may also be included in future Firefox 1.5.x releases.

Note: Some of the bugs in this list apply to new functionality not found in earlier releases, and are mainly of interest to people testing nightly builds.

Fixed on Trunk

The trunk is where bleeding edge Mozilla development takes place. Fixes on the trunk will be included in Firefox 3.0, and may be included in future Firefox 1.5.x and 2.0 releases.

Note: Some of the bugs in this list apply to new functionality not found in earlier releases, and are mainly of interest to people testing nightly builds.

Known Leaky Extensions

Fixed

Not Fixed

How Can I Help?

Memory Leak Detection Tool

David Baron recently wrote a tool that testers can use to help reduce memory leaks in Firefox. It tracks three types of objects (documents, docshells, and domwindows), and attempts to report the URLs associated with the leaks that are detected. For more information, see the following weblog entries: [Please file good memory leak bugs (David Baron)]
[Please file good memory leak bugs, Part 2 (David Baron)]
[Firefox memory leak detection tool (Jesse Ruderman)]

Leak Monitor Extension

David Baron has written an extension to detect a specific type of memory leak in Firefox. It detects when JavaScript objects in the chrome or Web page are still held by native code after the window is closed. The information provided by this extension can be used for filing bugs, however reading the information on the extension page is essential before using it for this purpose.

[More Information]
[Install Leak Monitor]

Things That are Not Leaks

Firefox Memory Usage Doesn't Always Go Down

This is generally not an issue, and does not represent a memory leak. Why? When Firefox is finished with memory, it releases it to its heap. However, operating system reports this memory as being in use, even though Firefox is not using it for anything. A common symptom of this is the amount of memory used by Firefox going up, but not coming down - instead staying constant.

Large Images are Not Compressed

When Firefox displays images it decompresses them. When combined with memory cache and Fast Back/Forward (bfcache), this can cause pages with large or many images to make the browser use a lot of memory. This is not a leak, because when the memory is not required it gets released to the heap.

Translations