Firefox Memory leak and fix February 27, 2006
Posted by AskMike in Computers & Internet.trackback
Firefox memory usage has been quite a hot topic since the release of
Firefox 1.5. This note 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.
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.
To disable the memory cache entirely, set browser.cache.memory.enable
to false. Note that this is not advised unless you’re extremely short
of memory, as it can slow things down severely, as well as causing
other odd behaviour.
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 config.trim_on_minimize to true using about:config.
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 browser.sessionhistory.max_total_viewers to 0 using about:config. 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.
Themes, Extensions, Plugins
Themes and 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.
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_06.
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.5 can help reduce memory
usage. Disabling unused Adobe Reader plugins can help too.
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.
Acknowledgements
The information and solutions in this thread have been sourced from
various users and threads, and the MozillaZine knowledge base.
Technorati Tags: Firefox, browser, Internet, memory leak

Comments»
No comments yet — be the first.