Reducing memory usage - Firefox: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
m (→‎External links: removed dead link)
(Image-heavy sites consume lots of mem. in Fx 4 and some previous versions)
Line 18: Line 18:
==Download history==
==Download history==
In Firefox 2, memory usage can increase and Firefox can slow down or hang if the download history is allowed to accumulate [https://bugzilla.mozilla.org/show_bug.cgi?id=273244].  The best solution is to update Firefox.  Alternately,  clear the download history (you may need to exit Firefox and delete the file [[downloads.rdf]] file from the [[Profile folder - Firefox |profile folder]] in some cases  [https://bugzilla.mozilla.org/show_bug.cgi?id=306190]) and change your Download History settings to remove files from the Download Manager "Upon successful download"  to circumvent the problem.
In Firefox 2, memory usage can increase and Firefox can slow down or hang if the download history is allowed to accumulate [https://bugzilla.mozilla.org/show_bug.cgi?id=273244].  The best solution is to update Firefox.  Alternately,  clear the download history (you may need to exit Firefox and delete the file [[downloads.rdf]] file from the [[Profile folder - Firefox |profile folder]] in some cases  [https://bugzilla.mozilla.org/show_bug.cgi?id=306190]) and change your Download History settings to remove files from the Download Manager "Upon successful download"  to circumvent the problem.
==Image-heavy sites==
Web sites with a lot of large images can require very large amounts of memory.  By default, Firefox stores images for a time in uncompressed form.  This results in an improvement in speed at the expense of greater memory use.  If too many large, uncompressed images are in memory simultaneously, this can lead to heavy hard drive use (memory paging), or it can even exhaust all memory resources or cause Firefox to terminate without warning.  This problem can be mitigated by limiting the length of time that images will be stored in uncompressed form.  To do so, set image.mem.min_discard_timeout_ms to 10000 (10 seconds -- Firefox 4.0.1 default is 120 seconds) on the [[About:config]] page or create a new integer option by that name.


==Settings that reduce memory usage==
==Settings that reduce memory usage==
Line 58: Line 61:
* [http://web.archive.org/web/20080519053913/http://plugindoc.mozdev.org/faqs/memusage.html Firefox Memory Usage FQA at PluginDoc (Archive copy)]   
* [http://web.archive.org/web/20080519053913/http://plugindoc.mozdev.org/faqs/memusage.html Firefox Memory Usage FQA at PluginDoc (Archive copy)]   
[[Category:Performance - Firefox]]
[[Category:Performance - Firefox]]
[[Category:Issues (Firefox)]]
[[Category:Issues (Firefox)]]Bug 573583 - enable decode-on-draw
 
===Related bug reports===
*[https://bugzilla.mozilla.org/show_bug.cgi?id=660577  Bug 660577 - Image-heavy sites are slow and often abort due to OOM; regression from 3.6]

Revision as of 16:13, 6 June 2011

For most users, Firefox doesn't use an abnormally large amount of memory. For others, however, Firefox's memory consumption is a major problem. This article discusses how to lower Firefox's memory consumption.

Firefox caches objects for future use. In addition, memory becomes fragmented as memory is repeatedly allocated and deallocated.[1] This general increase is normal.

Normal Firefox memory usage reported by Windows might be as high as 100-150 MB. These numbers will vary because Firefox is configured by default to use more memory on systems that have more memory available and less on systems with less. If you experience substantially more usage than this, there may be a problem, or you may just be viewing pages with large amounts of data.

Extensions and themes

Observing memory usage while Firefox is in safe mode may help tell you whether one of your extensions or themes is causing memory problems (but will not uncover memory usage by #Plugins). If you find a significant reduction in memory usage, you may be able to find updates for your extensions and themes or alternative extensions and themes that use less memory. You should also review the list of extension-specific problems. Failing that, uninstalling the extensions and themes is an option.

Plugins

Plugins can cause Firefox to use more memory when they're used and may not release their memory until Firefox is closed. It's a good idea to make sure you're using the most recent version of every plugin by visiting Mozilla's Plugin Check page. To save the maximum amount of memory, uninstall any unnecessary plugins. Here's some plugin-specific information.

System extensions

WindowBlinds can dramatically increase memory use.[2] To continue using WindowBlinds and Firefox without memory issues, add Firefox to WindowBlind's exclusion list.

Download history

In Firefox 2, memory usage can increase and Firefox can slow down or hang if the download history is allowed to accumulate [3]. The best solution is to update Firefox. Alternately, clear the download history (you may need to exit Firefox and delete the file downloads.rdf file from the profile folder in some cases [4]) and change your Download History settings to remove files from the Download Manager "Upon successful download" to circumvent the problem.

Image-heavy sites

Web sites with a lot of large images can require very large amounts of memory. By default, Firefox stores images for a time in uncompressed form. This results in an improvement in speed at the expense of greater memory use. If too many large, uncompressed images are in memory simultaneously, this can lead to heavy hard drive use (memory paging), or it can even exhaust all memory resources or cause Firefox to terminate without warning. This problem can be mitigated by limiting the length of time that images will be stored in uncompressed form. To do so, set image.mem.min_discard_timeout_ms to 10000 (10 seconds -- Firefox 4.0.1 default is 120 seconds) on the About:config page or create a new integer option by that name.

Settings that reduce memory usage

Changing the about:config preferences below may have an effect on memory consumption but may also affect performance or reduce functionality. Read each article for the preference's effects. Each preference includes an estimate of the amount of memory that can be freed on an average (512MB RAM) system by choosing the most memory-friendly setting.

Preference Max memory freed
browser.cache.memory.capacity and browser.cache.memory.enable 14MB
browser.sessionhistory.max_total_viewers 20MB

The config.trim_on_minimize setting (Windows only) does not reduce the amount of memory used, it just swaps memory from RAM to disk. This may make Firefox slow to "wake up". If config.trim_on_minimize is left set at the default value (false), the memory will be swapped to disk only if it is needed by another application. Therefore, for most purposes the default value is recommended.

The RAMBack extension, available for Firefox 3, allows the user to manually free memory, such as caches, that is usually used to increase performance. This gives the advantage of small cache sizes without having to always suffer the performance hit.

Restarting Firefox

If you find that Firefox's memory usage continues to grow after long periods of being open, you may want to consider periodically restarting Firefox to bring the memory usage back to reasonable levels. Close Firefox and select the Save and Quit option to reopen your tabs when Firefox restarts.

Memory leaks

Memory leaks can cause Firefox not to release memory that it is no longer using, especially with older versions. There has been a lot of effort to reduce the leaks in recent versions, and Mozilla developers have have created tools to detect them. [5] [6] To minimize leaks, you should upgrade to the most recent version. The most common memory leaks appear to have been fixed in Firefox 2. [7] Firefox 3 uses even less memory than Firefox 2 due to more memory leak fixes and further efforts to reduce memory usage. [8] [9] [10] [11]

Virtual memory

Some Windows users have problems with Firefox memory usage because they have virtual memory turned off or have a paging file that is too small. These articles provide additional information:

Safety first

Some precautions that you can take that will help reduce misuse by websites on your machine

Still experiencing problems?

External links

Related bug reports