15

I have a small memory and Firefox is using a big chunk of it, I need to reduce its memory usage as much as possible. One possible solution is for Firefox to automatically suspend idle tabs.

First of all, for all solutions in Automatically suspend or hibernate tabs in Firefox:

For the top answer there,

For Firefox >= 59, there is Auto Tab Discard.

That's not what I am after as I don't like my tabs being discarded and disappears. I just want them to be suspended or hibernated, until I revisit them again.

For the second answer there, found the "built-in feature" mentioned in https://superuser.com/a/504513/203539 at https://gearupwindows.com/how-to-enable-or-disable-tab-sleep-feature-in-firefox-browser/

Which says:

To disable the Tab Sleep at any time, double-click on the browser.tabs.unloadOnLowMemory preference to set its value to false.

That’s all. Once you have completed the above steps, restart Firefox and it’ll enable/disable the Tab Suspend feature in Firefox based on the value of the preference. If you have set the value to true, whenever you are working with too many tabs and some tabs are not accessed for some minutes, Firefox will automatically suspend those idle tabs.

However, when I checked mine, it has been true all the time and I had never ever seen any of my tabs been put into sleep mode, even when my system was very low in memory, which triggered me in such treasure hunting.

Besides that, I've also found

Tab Unloading
https://firefox-source-docs.mozilla.org/browser/tabunloader/

which says

You can trigger tab unloading manually by clicking the Unload button in the page.

But look at how my tabs are taking memory now (few hundreds of Megs):

enter image description here

yet, my Firefox is taking over 2.5G of my memory:

enter image description here

UPDATE:

I tried the proposed "quit & relaunch" suggestion but found it has some effects but is not fully working as I expected -- my Firefox is still over 1.5G:

enter image description here

Whereas I was hoping it can be under 800M, as you can see I've managed to reduce the chrome memory footprint using tab hibernation, and MS Edge is always doing an amazing job limiting its memory footprint. The only thing left is my Firefox.

So, how to reduce Firefox's memory usage as much as possible please?

xpt
  • 9,385
  • 44
  • 120
  • 178

4 Answers4

10

This is due to the resource-sucking madness of modern browsers and web programming.

Literally it says - open less content: https://support.mozilla.org/en-US/kb/firefox-uses-too-much-memory-or-cpu-resources

Disable resource consuming extensions and themes
Hide intrusive content
Use fewer tabs(!)
Close tabs that use too many system resources(!)
Close other applications(!)
Add RAM to your computer

Chrome is not better in memory cosumption.

gapsf
  • 440
6

I'm dealing with the same problem right now, and here's what I've come up with...

Based on resources in the link in gapsf's answer, there are a couple tools in Firefox that can help manually curtail memory use.

You can use the Firefox Process Manager to triage your efforts.

To open the Process Manager, click the menu (hamburger) button, click More Tools and select Task Manager from the menu. The about:processes page will open in a new tab.

You can also enter about:processes in the address bar or use the keyboard shortcut Shift + Esc to open this page.

You can then sort based on memory to help focus efforts:

Screenshot of the first few entries in the Firefox process manager when sorted by descending memory

This was enough in my case, as I found my extensions were using ~600MB. After removing and disabling a few, I'm down to ~100MB while keeping important extensions like uBlock Origin and Dark Reader enabled. Much to my surprise, Adblock Plus alone was using ~300MB.

You might also have some luck with the about:memory page.

The about:memory page allows you to troubleshoot specific issues relating to memory (for instance, caused by a website, an extension, a theme, etc.) and sometimes its Minimize memory usage button may help you instantly reduce memory usage. For guidance on use of about:memory visit about:memory.

enter image description here

Clicking Show memory reports > Measure (underlined in green) will show a detailed trace of where memory is being used in individual processes. Clicking Free memory > Minimize memory usage (underlined in magenta) might also be fruitful.

drmuelr
  • 171
0

In the about:config I also had browser.tabs.unloadOnLowMemory set to true from the start. So I unchecked and checked it again to true, and now it is really working. It's night and day!

Madacol
  • 111
-1

Download the latest https://github.com/lowleveldesign/process-governor and extract the program in to the same place as Firefox's EXE file.

Create a TXT file and place the following inside of it:

CD "C:\Program Files\Mozilla Firefox"
procgov64.exe -r --minws=1M --maxws=512M firefox.exe

Now save the TXT file and then change the file extension to "bat" without the quotes.

Final steps are to create a Shortcut to the Bat file and configure the shortcut to launch as an Administrator. Use this shortcut to launch Firefox with it constrained to 512MB (times the number of Firefox processes) of RAM. Make sure you have not disabled nor severely limited the size of the Page File in Windows to avoid out of memory errors in Firefox.

Edit: The batch file will need to be executed as an Administrator and the memory limit of 512MB will apply to each Firefox process (for me Firefox spawns 12 processes, so that's 12x512MB). Despite running the Batch file as an administrator, Process Governor does not launch Firefox in an elevated state.