Reducing memory usage - Firefox: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
(add tip about virtual memory settings)
m (→‎Related bug reports: added product=Core to bug list)
 
(45 intermediate revisions by 9 users not shown)
Line 1: Line 1:
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. Typical Firefox memory usage reported by Windows is around 50-100 MB, with virtual memory usage at 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.
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.[http://www.pavlov.net/blog/archives/2007/11/memory_fragment.html]  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==
==Extensions and themes==
Observing memory usage while Firefox is in [[safe mode]] will tell you whether one of your extensions or themes is causing memory problems. 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 [[Problematic extensions | this article]] which discusses extension-specific problems. Failing that, uninstalling the extensions and themes is an option.
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 [[Problematic extensions | list of extension-specific problems]]. Failing that, uninstalling the extensions and themes is an option.


==Plugins==
==Plugins==
[[:Category:Plugins|Plugins]] can cause Firefox to use more memory when they're used. They may not even release the memory they took until Firefox is closed. It's a good idea to make sure you're using the most recent version of every plugin. Here's some plugin-specific information.
[[:Category: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 [http://www.mozilla.org/plugincheck Plugin Check] page.  To save the maximum amount of memory, uninstall any unnecessary plugins. Here's some plugin-specific information.
* [[Shockwave#Memory_usage | Shockwave memory usage]]
* [[Java#Memory_use|Java memory usage]]


* [[Adobe_Reader#Speeding_up_PDF_display | Reducing Adobe Reader memory usage]]
==System extensions==
* [[Shockwave#Memory_usage | Shockwave memory usage]]
[http://www.stardock.com/products/windowblinds/ WindowBlinds] can dramatically increase memory use.[http://forums.mozillazine.org/viewtopic.php?t=467443] To continue using WindowBlinds and Firefox without memory issues, add Firefox to WindowBlind's exclusion list.


==Download history==
==Image-heavy sites==
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]. Clear the download history (you may need to exit Firefox and delete the file "downloads.rdf" from the [[profile folder]] in some cases [https://bugzilla.mozilla.org/show_bug.cgi?id=306190]) and change this setting to circumvent the problem:
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.[https://bugzilla.mozilla.org/show_bug.cgi?id=660577#c36]
* "Tools -> Options -> Privacy -> Download History -> Remove Files from the Download Manager", select: "Upon successful download".


==Settings that reduce memory usage==
==Settings that reduce memory usage==
Line 21: Line 26:
|-
|-
| [[browser.cache.memory.capacity]] and [[browser.cache.memory.enable]]
| [[browser.cache.memory.capacity]] and [[browser.cache.memory.enable]]
| 22MB
| 14MB
|-
|-
| [[browser.sessionhistory.max_total_viewers]]
| [[browser.sessionhistory.max_total_viewers]]
| 20MB
| 20MB
|-
| [[config.trim_on_minimize]] (Windows only)
| all but 10MB when minimized
|}
|}
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 [https://addons.mozilla.org/en-US/firefox/addon/5972 RAMBack extension] 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.  In some cases it may be useful for diagnosing memory problems, allowing the user to distinguish between cache use and other memory use, although the cache can also be cleared from the Tools menu, without this extension.  Detailed information on memory use is also available in the about:cache and about:memory pages.


==Restarting Firefox==
==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. The [http://forums.mozillazine.org/viewtopic.php?t=380534 Session Manager] extension allows you to close Firefox while maintaining the pages you have open.
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==
Memory leaks occur to some extent in Firefox. These memory leaks cause Firefox to not release memory that it is no longer using. 1.5.0.1 fixed several memory leaks. If you have not already, you should upgrade to this release.
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. [http://www.squarefree.com/2006/01/13/memory-leak-detection-tool/] [http://dbaron.org/mozilla/leak-monitor/]  To minimize leaks, you should upgrade to the most recent version.
 
==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:
* [http://www.aumha.org/win4/a/memmgmt.htm Windows 98 & WinME Memory Management] 
* [http://www.aumha.org/win5/a/xpvm.htm Virtual Memory in Windows XP]
 
==Safety first==
Some precautions that you can take that will help reduce misuse by websites on your machine
* <nowiki>[Windows]</nowiki> [http://www.mvps.org/winhelp2002/hosts.htm Blocking Unwanted Parasites with a Hosts File]
* [https://addons.mozilla.org/firefox/addon/1865/ Adblock Plus] extension, with at least one filter subscription such as EasyList, also effective against most unwanted pop-ups.


[http://www.squarefree.com/2006/02/04/memory-leak-progress/ Here] is an update on memory leaks in Firefox. You can help to find and fix memory leaks by reading [http://www.squarefree.com/2006/01/13/memory-leak-detection-tool/ this].
==Still experiencing problems?==
* The [[Standard diagnostic (Firefox) | standard diagnostic]] may resolve memory problems not specifically mentioned in this article.


==Virtual memory==
==External links==
Some users have problems with Firefox memory usage because they have virtual memory turned off or have a paging file that is too small. For optimal results on Windows, virtual memory should be turned on, and the paging file size should be at least 1.5 times the amount of RAM on the system. For example, on a computer with 512 MB of RAM, the paging file size should be at least 768 MB.
* [https://support.mozilla.org/kb/firefox-uses-too-much-memory-ram Firefox uses too much memory (RAM) - How to fix]
* [http://web.archive.org/web/20080519053913/http://plugindoc.mozdev.org/faqs/memusage.html Firefox Memory Usage FQA at PluginDoc (Archive copy)] 
 
===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]
*[https://bugzilla.mozilla.org/buglist.cgi?list_id=6513636&resolution=---&status_whiteboard_type=allwordssubstr&query_format=advanced&status_whiteboard=MemShrink&product=Core&product=Firefox List of open bugs related to reducing memory usage]


[[Category:Firefox]]
[[Category:Performance - Firefox]]
[[Category:Issues (Firefox)]]

Latest revision as of 10:14, 11 May 2013

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.

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.[3]

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 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. In some cases it may be useful for diagnosing memory problems, allowing the user to distinguish between cache use and other memory use, although the cache can also be cleared from the Tools menu, without this extension. Detailed information on memory use is also available in the about:cache and about:memory pages.

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. [4] [5] To minimize leaks, you should upgrade to the most recent version.

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