Reducing memory usage - Firefox

From MozillaZine Knowledge Base
(Redirected from Memory Leak)
Jump to navigationJump to search

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