ابحث في الدعم

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Is there literally no way to control firefox's memory usage? I have tried a lot of things and none of them work

  • 7 ردود
  • 1 has this problem
  • 9 views
  • آخر ردّ كتبه zeroknight

more options

Hello, I have been a diehard Firefox user since it was still in Beta. I have been using computers personally since 1994 and professionally since 2004, doing Windows and Linux systems administration. I can and will do whatever (within limits) you need me to do to troubleshoot and resolve this issue, which is otherwise going to cause me to abandon this otherwise excellent browser, perhaps forever. The browser.cache.disk.capacity seems to work, but browser.cache.memory.capacity does not.

Why does firefox not respect the assigned values for browser memory cache (browser.cache.memory.capacity)? Is there anything I can do to limit the memory and processor usage of Firefox and its child processes? Is extension CPU/memory usage constrained by the application values? Is there a way to determine and/or limit the resource usage of extensions?

I have included a number of screenshots documenting its behavior and generated an about:memory report during "normal use". After configuring a number of system variables, I then attempted to determine its resource usage under heavy load.

Open the browser with a couple 2, 3 tabs: ~1GB memory usage Use the browser as "normal" (dozens tabs): ~2GB memory usage Open 100+ tabs from history: The CPU and memory resource usage increases until it consumes all available system resources despite configured values. After killing and restarting the process, the tabs have invisible titles in the extension and browser, and must be closed using Ctrl+W until only a few remain after which the browser can be used normally and again consumes ~1GB.

While I understand "just don't open so many tabs", under some circumstances such as poorly written websites, bugs, etc, even single sites may attempt to claim excessive resources. I sometimes run VMs and such on this machine and in order to retain a responsive system, cannot have applications consuming all of the available resources. I have found one proposed solution that uses an external application, is this the only way?

I am open to allowing Firefox to utilize more of the SSD storage (the 1GB limit was imposed for testing) and would be fine with increased slowness due to disk cache or refetching internetworked resources. However, none of the settings I have changed or attempts I have made appear to be able to limit the memory usage in any way. Additional included screenshots are linked above instead of as attachments due to number. I can share or generate additional reports to assist in troubleshooting.

Thank you! JackD

Hello, I have been a diehard Firefox user since it was still in Beta. I have been using computers personally since 1994 and professionally since 2004, doing Windows and Linux systems administration. I can and will do whatever (within limits) you need me to do to troubleshoot and resolve this issue, which is otherwise going to cause me to abandon this otherwise excellent browser, perhaps forever. The '''browser.cache.disk.capacity''' seems to work, but '''browser.cache.memory.capacity''' does not. Why does firefox not respect the assigned values for browser memory cache ('''browser.cache.memory.capacity''')? Is there anything I can do to limit the memory and processor usage of Firefox and its child processes? Is extension CPU/memory usage constrained by the application values? Is there a way to determine and/or limit the resource usage of extensions? [https://imgur.com/gallery/UYBM0oX I have included a number of screenshots documenting its behavior] and generated an''' about:memory '''report during "normal use". After configuring a number of system variables, I then attempted to determine its resource usage under heavy load. Open the browser with a couple 2, 3 tabs: ~1GB memory usage Use the browser as "normal" (dozens tabs): ~2GB memory usage Open 100+ tabs from history: The CPU and memory resource usage increases until it consumes all available system resources despite configured values. After killing and restarting the process, the tabs have invisible titles in the extension and browser, and must be closed using Ctrl+W until only a few remain after which the browser can be used normally and again consumes ~1GB. While I understand "just don't open so many tabs", under some circumstances such as poorly written websites, bugs, etc, ''even single sites may attempt to claim excessive resources''. I sometimes run VMs and such on this machine and in order to retain a responsive system, cannot have applications consuming all of the available resources. I have found one proposed solution that [https://superuser.com/posts/1771172/revisions uses an external application], is this the only way? I am open to allowing Firefox to utilize more of the SSD storage (the 1GB limit was imposed for testing) and would be fine with increased slowness due to disk cache or refetching internetworked resources. However, none of the settings I have changed or attempts I have made appear to be able to limit the memory usage in any way. Additional included screenshots are linked above instead of as attachments due to number. I can share or generate additional reports to assist in troubleshooting. Thank you! JackD
Attached screenshots

All Replies (7)

more options

Do you need to have all tabs loaded at once? The extension mentioned below allows you to unload tabs you are not actually using without closing them. You can reload them with the tab right-click menu and unload them again in the same way.

https://addons.mozilla.org/firefox/addon/auto-tab-discard/

more options

Tab unloading is disabled by default on Linux, you can enable it by going to about:config and changing browser.tabs.unloadOnLowMemory to true. You can make it more aggressive by increasing browser.low_commit_space_threshold_percent (Linux only) and browser.low_commit_space_threshold_mb.

Reduce the number of processes per site by changing dom.ipc.processCount.webIsolated to 1.

more options

Hadn't changed dom.ipc.processCount.webIsolated to 1 yet.

I did have config_trim_on_minimize set to true, which is supposed to trim memory when the browser is minimized.

I had browser.tabs.unloadOnLowMemory to true

browser.low_commit_space_threshold_mb is currently set to 200, this is, I assume, the amount of memory remaining after which firefox considers the system to be "low" on memory? "Still have 200mb left after I consumed 6000, that should be enough, right?" lol, I'll try raising it to something like 4096 (my VM needs at least 2GB)

"but a problem we could not get past was that finding a balance between decreasing the browser’s memory usage and annoying the user because there’s a slight delay as the tab gets reloaded" Really? I would rather wait seconds to have page reloads than have it consume all of my available resources and prevent me from using my PC for anything other than browsing. I want it to unload tabs when memory usage increases past a certain point, not when it gets so critically low it endangers my system. And I also see there is a "about:unloads" which I will look into.

I also increased disk cache to 10GB which, although I feel is absurd as the cache for a web browser a memory usage of 8GB for 100 tabs is 80MB per tab which, again, seems insane.

I also changed browser.tabs.min_inactive_duration_before_unload from 600000 to 300 !?!? 10,000 minutes at least until unload? Am I reading that right?

The thing I do not understand, though, is why does it have zero respect for the set size of the RAM cache? Am I setting something wrong?

more options

I even tried using the procgov64 application and it still uses over the set amount.

more options

jackd2 said

I also changed browser.tabs.min_inactive_duration_before_unload from 600000 to 300 !?!? 10,000 minutes at least until unload? Am I reading that right?

That setting is in milliseconds, so tabs need to be inactive for at least 10 minutes before they can be unloaded.

why does it have zero respect for the set size of the RAM cache?

browser.cache.memory.capacity is just the network cache and does not govern any other memory usage. You can see it working at about:cache, the capacity limit is enforced periodically.

There is also the media cache to consider (media.memory_caches_combined_limit_kb), default 500MB or 5% of total RAM.

more options

media.memory_caches_combined_limit_kb is already set to 512MB, as specified.

I even set browser.cache.memory.enable to false. I'm getting 2.6GB of memory used for a single open gmail tab. This is absurd. I really like firefox, but if there is literally no way to stop it from using up all of the resources on my computer, I can't use it. On my other computer, htop reports 50GB of RAM used, which I imagine is the amount claimed, but not actually used, but is still absurd.

I don't want a web browser, a single program on my computer, using all of the resources or even being capable of using all the resources. There's no way to effectively limit this? What are people doing? Just letting it utilize all their available resources?

more options

For reference, a single gmail tab uses around 200MB for me when initially opened in a new profile. See if you get different results with flatpak or the official build.

jackd2 said

htop reports 50GB of RAM used

You are probably looking at the virtual memory column which can be safely ignored, the numbers there have no relevance to actual performance. Advanced web features like WebAssembly need to reserve a lot of virtual memory.