Browser.cache.memory.capacity - Better

browser.cache.memory.capacity is a Mozilla-based browser (like Firefox, Thunderbird, or Pale Moon) preference that determines the maximum amount of Random Access Memory (RAM) dedicated to caching decoded images, script data, and other web content.

Unlike the disk cache, which saves data to your physical drive to persist between sessions, the memory cache is temporary and cleared when you close the browser. Key Values & Functions

-1 (Default): Tells the browser to automatically determine the capacity based on your system's total physical RAM.

0: Effectively disables the memory cache. This is generally not recommended as it forces the browser to fetch data from the slower disk cache or the internet for every request, potentially slowing down navigation.

Positive Integer: A custom limit set in Kilobytes (KB). For example, entering 524288 would cap the memory cache at 512 MB. How to Modify It Open your browser and type about:config in the address bar. Search for browser.cache.memory.capacity. Double-click the entry and enter your desired value in KB.

Ensure browser.cache.memory.enable is set to true for this to take effect. Why Adjust This Setting?

Any reason not to make more RAM available for browser cache?

Understanding browser.cache.memory.capacity The browser.cache.memory.capacity preference is a critical setting in Firefox and related browsers that determines how much System RAM is used to store recently accessed web data. By fine-tuning this value, users can significantly influence their browser's responsiveness and overall system performance. What Does This Setting Do?

Web browsers typically use two types of caches: disk cache and memory cache.

Disk Cache: Stores data on your hard drive or SSD. It is persistent but relatively slow to access.

Memory Cache: Stores data directly in your RAM. It is extremely fast but volatile, meaning it is cleared whenever the browser or computer restarts.

The browser.cache.memory.capacity integer specifically controls the maximum size of this fast-access RAM cache in kilobytes (KB). Why Adjust It?

Most users never need to touch this setting because modern Firefox versions (v4.0+) use dynamic cache sizing based on your available system resources. However, manually adjusting it can be beneficial in several scenarios:

Low-Memory Systems: If you have a computer with limited RAM (e.g., 2GB or less), capping this value can prevent the browser from "hogging" memory and slowing down other applications.

High-Performance Systems: If you have 16GB or more of RAM, increasing this capacity can speed up "Back" and "Forward" navigation by keeping more web elements ready in the fastest possible storage.

Privacy & SSD Longevity: Some users disable the disk cache entirely and force everything into memory to ensure no browsing data is written to their physical drive. How to Configure browser.cache.memory.capacity

This setting is found in the Advanced Configuration Editor (about:config). Step-by-Step Instructions

Access about:config: Open a new tab, type about:config in the address bar, and press Enter. Click the button to "Accept the Risk and Continue". Browser.cache.memory.capacity

Locate the Preference: Type browser.cache.memory.capacity into the filter box.

Note: If the preference does not exist, right-click any blank area, select New > Integer, and name it exactly as written above. Enter a Value:

-1 (Default): Automatically determines the cache size as a percentage of your physical RAM. 0: Disables the memory cache entirely.

Positive Number: Sets a specific limit in KB. For example, 51200 would limit the cache to 50 MB. Recommended Values for Different RAM Sizes

Historically, the MozillaZine community suggested these starting points for older hardware: Physical RAM Suggested Cache Value (KB) -1 (Automatic) Related Settings for Better Performance

To get the most out of your memory cache, ensure the following related preferences are also set correctly in about:config:

browser.cache.memory.enable: Must be set to true for the capacity setting to function.

browser.cache.disk.enable: Set to false if you want to bypass the slower disk cache entirely and rely only on RAM.

While modern browsers are excellent at managing memory on their own, understanding browser.cache.memory.capacity empowers you to optimize your browsing experience to match your specific hardware and privacy needs. Firefox/Tweaks - ArchWiki

The setting browser.cache.memory.capacity is a "hidden" configuration in Mozilla Firefox

that determines how much system RAM (memory) the browser can use to store web pages, images, and scripts for instant retrieval. Unlike the disk cache, which stores files on your hard drive, the memory cache is significantly faster but is cleared every time you close the browser. 1. How to Access the Setting

Since this isn't in the standard "Settings" menu, you must access it via Firefox's advanced configuration page: about:config in the Firefox address bar and press Enter. Click "Accept the Risk and Continue." In the search box at the top, type browser.cache.memory.capacity 2. Available Values and What They Do

Depending on your needs, you can set this integer to various values:

Recommended for most users. Firefox dynamically calculates the size based on your total system RAM.

Completely turns off memory caching. Not recommended as it slows down browsing significantly. Positive Integer Manual Limit Sets a fixed limit in kilobytes (KB) 3. Recommended Manual Settings

If you have a specific reason to limit or increase memory usage (such as running on a system with very low RAM), use these common values: (Very low-end systems) (Standard limit for low RAM) (Smooth browsing for older PCs) (Power users with 16GB+ RAM who want maximum speed) 4. Why You Might Change This High Memory Usage:

If Firefox is consuming too much RAM, setting a lower manual limit (like ) can prevent it from "ballooning" over time ( MozillaZine SSD Longevity: Some users disable the disk cache browser.cache.disk.enable ) and increase the memory cache instead to reduce physical writes to their SSD ( openSUSE Forums browser

Increasing this value can make "Back" and "Forward" navigation feel near-instant, as pages are kept in RAM rather than being re-fetched from the disk. 5. Troubleshooting If you search for the preference and it does not appear , you can create it: Right-click anywhere on the about:config browser.cache.memory.capacity Enter your desired value (e.g., for auto). , such as disabling the disk cache or managing multi-process (e10s)

A Firefox configuration parameter!

Here's some information on the browser.cache.memory.capacity parameter:

What is it?

browser.cache.memory.capacity is a configuration parameter in Firefox that controls the amount of memory allocated for caching web pages, images, and other web content.

What does it do?

When you visit a website, Firefox stores some of the content in memory (RAM) so that if you revisit the same page or navigate to a similar page, it can load faster. This is known as caching. The browser.cache.memory.capacity parameter determines how much memory is allocated for this caching.

How does it work?

The value of browser.cache.memory.capacity is measured in kilobytes (KB). When Firefox starts, it allocates a portion of memory based on this value. As you browse the web, Firefox stores cache entries in this allocated memory. When the cache grows, Firefox uses a least-recently-used (LRU) algorithm to evict older cache entries to make room for new ones.

Effects of changing the value

Default value

The default value of browser.cache.memory.capacity varies depending on the system and Firefox version. On a typical system, the default value might be around 50-100 MB (50,000-100,000 KB).

How to modify the value

To modify the value of browser.cache.memory.capacity, follow these steps:

  1. Type about:config in the address bar and press Enter.
  2. Search for browser.cache.memory.capacity in the search bar.
  3. Double-click on the preference to modify its value.
  4. Enter a new value in kilobytes (KB).

Caution

Modifying this value can have unintended consequences, such as:

It's essential to monitor your system's performance and adjust the value accordingly. Increasing the value : A larger cache capacity

Related preferences

Other related Firefox configuration preferences include:

Keep in mind that these preferences are intended for advanced users and may require careful tuning to achieve optimal results.

The preference browser.cache.memory.capacity is a hidden setting in Firefox's about:config that controls the maximum amount of RAM allocated for the browser's memory cache.

Increasing this value can speed up page navigation (especially the Back/Forward buttons) by keeping recently visited pages in RAM instead of reloading them from the slower disk or the internet. How to Configure It

Access Settings: Type about:config in your address bar and click "Accept the Risk and Continue."

Find or Create: Search for browser.cache.memory.capacity. If it doesn't exist, right-click (or click the "+" button), choose New > Integer, and name it exactly as above.

Enter Value: Input the amount of RAM you want to use in Kilobytes (KB):

-1: The default setting. Firefox dynamically determines the size based on your total system RAM. 0: Disables the memory cache entirely.

Custom (e.g., 131072): Sets a fixed limit (e.g., 131,072 KB = 128 MB). Common Use Cases


Mastering browser.cache.memory.capacity: The Ultimate Guide to Firefox’s In-Memory Cache

The Case for Increasing Capacity

Scenario: You have 32GB or 64GB of RAM. You typically keep Firefox open for days with 50+ tabs. You frequently revisit complex web applications (Slack, Figma, Gmail).

Outcome: By increasing the memory cache, you allow Firefox to store more pre-rendered versions of these heavy apps. Navigating between tabs becomes instantaneous. Scrolling through a long history within the same tab feels fluid because assets never leave RAM.

Recommended value: 204800 (200 MB) to 512000 (500 MB). For extreme users with 64GB+ RAM, 1048576 (1 GB) is viable, albeit excessive for most browsing.

How to Modify the Preference

Warning: Editing about:config can introduce stability issues or security risks. Proceed with caution.

Step-by-step guide:

  1. Open Mozilla Firefox.
  2. Type about:config into the address bar.
  3. Accept the risk warning.
  4. In the search bar, type browser.cache.memory.capacity.
  5. You will see one of two states:
    • Default: The preference may not exist yet. If missing, Firefox uses -1.
    • Modified: The preference exists with a numerical value.
  6. To edit:
    • To reset to default: Right-click the preference and select "Reset." (Value becomes -1).
    • To set a custom size: Double-click, enter a number in Kilobytes, and press Enter.

Conversion formula: MB × 1024 = KB. For 250 MB, enter 256000.

Historical context and modern relevance

Executive Summary

browser.cache.memory.capacity is a preference setting found primarily in Mozilla Firefox and other Gecko-based browsers. It determines the maximum amount of Random Access Memory (RAM) allocated to caching decoded images, scripts, and webpages. Adjusting this setting allows users to control the trade-off between memory usage and browser performance (snappiness). While modern browsers manage this automatically, manual adjustment can be beneficial for users with extreme hardware constraints or those seeking maximum performance on high-end machines.


The Pitfall: Why Bigger Isn't Always Better

A common misconception among novice tuners is that setting browser.cache.memory.capacity to 999999999 (roughly 1 TB) will make Firefox fly. It will not. Here is why:

  1. Garbage Collection Overhead: The larger the cache, the longer the browser's garbage collector takes to scan, prune, and evict stale entries. With a massive cache, the "eviction cycle" can cause noticeable micro-stutters.
  2. Diminishing Returns: Most users revisit fewer than 100 unique pages per session. A 1GB cache does not store 10x more useful data than a 100MB cache; it just stores 10x more useless, obsolete entries.
  3. Operating System's Own Cache: Modern OSes (Windows, macOS, Linux) already aggressively cache file system and network operations in unused RAM. Firefox's disk cache is often already sitting in the OS's disk cache. Forcing a massive Firefox memory cache can actually create duplicate cached data, wasting RAM.

❌ When to decrease it