Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For a few months now I saw a huge improvement on Linux regarding the memory management of Firefox. Previously I had to run Firefox in a separate cgroup to limit its memory usage, because it could easily deplete my whole RAM. And if I did close most of my tabs it did not release the memory back to the system. Now I never actually get to the limit I've set before and also with Auto Tab Discard extension it is well managed. So kudos to the team for such improvements.


I'm glad you noticed! We did indeed roll an improvement on Linux too, see: https://bugzilla.mozilla.org/show_bug.cgi?id=1771712

In a nutshell we're directing the OOM killer towards less interesting processes within Firefox so that when the system is low on memory they'll get killed first. This not only makes it more stable overall but it plays nicer with other applications too. Web pages that leak memory in the background are particularly likely to be killed by this mechanism and that alone is a huge improvement in overall stability.


I was very excited about this improvement (it was covered on phoronix IIRC), but my systems still ends up thrashing when Firefox grows too big, unfortunately.

I usually keep an eye on the memory usage I have displayed in the taskbar, and have sysrq activated in case. I tried multiple things, including avoiding swapping to disk (only using zram), and Zen kernels. I'll have to see if I use MGLRU.


Do you use a userspace OOM killer, like oomd or systemd-oomd?


I haven't set that up yet, though I've watched the recemt developments with interest. Another option would be to launch everything (or just Firefox) in cgroups.


Does this OOM killer direction respect cgroup memory limits? Back when I was using Firefox on a low memory system, I ran it in a limited cgroup, but features like `browser.tabs.unloadOnLowMemory` wouldn't unload tabs on low cgroup memory, but only on low total system memory.


Yes it does, we've disabled tab unloading on Linux because low-memory detection just didn't work. We will re-enabled it sometimes down the line but only to avoid swap, not crashes. The OOM killer does already a good job with this change and we feel no need to do anything further (besides optimizing memory usage, but that's system-agnostic).


Correct me if I'm wrong, but the blog post is concerning a stability improvement on Windows specifically?


Yeah the article is about Windows. Even though you can see here: https://hacks.mozilla.org/author/gsveltomozilla-com/ that they also worked on MacOs and Linux stability this year.

I had abandoned Firefox entirely on MacOS until sometime I decided to try again and it was no longer attempting to claim an entire 32GB memory for itself. So, I am back as a happy user :)


It is, but it just reminded me of this other bit. Sorry if I was a bit too off topic. I just see those improvements on the sidelines and I'm glad.


> and also with Auto Tab Discard extension it is well managed

Have you compared it with the default Hibernation (Tab Unloading) recently? I don't use any extensions apart from UBlock Origin since I lost trust with extensions after seeing a recommended FF extension promoting scam.

When compared to Vivaldi's default hiberation(Where I have to manually trigger bg hibernation every now and then), FF's hibernation seems to do its thing (about:unload) quite well.


Me too, on macOS, I notice memory is freed more.


I'm exclusively using Firefox on MacOS now.


> And if I did close most of my tabs it did not release the memory back to the system.

Check out `about:memory` and `about:unloads`, the former has memory minimization options and the latter lets you unload background tabs from memory.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: