It’s only a problem if it doesn’t give it up when other apps need it and there’s not enough. Browsers just cache a bunch of shit in memory for speed and convenience, but they should unallocate it back to the pool if something else calls for it. The internet complaining about this for years and years are mostly doing so from a place of ignorance.
The issue is that browsers don’t release much memory back to the system when it’s needed. I wish they’d work more like the Linux kernel’s VFS caching later, but they don’t (and might not be able to. For example, I do don’t think the Linux kernel has good APIs for such a use case).
You can write limits to and then poll files in /proc/pressure/ to be notified of resource pressure. Systemd will also set an environment variable for similar files for your cgroup.
The issue is that browsers don’t release much memory back to the system when it’s needed. I wish they’d work more like the Linux kernel’s VFS caching later, but they don’t (and might not be able to. For example, I do don’t think the Linux kernel has good APIs for such a use case).
It does release it back to the system. It only doesn’t if you actively have a ton of windows/tabs open, in my experience. Even then, it’ll cache stuff to disk after awhile. Like on my phone, I’ve easily had over 20 tabs open in Firefox (Android) and it doesn’t suck up all of my phone’s ram (which only has 12GB). If your system is running less than 16GB, then that’s another matter and you really should add more, as 16GB is pretty much the baseline on computers these days.
Mine is 32GB and Firefox as consistently and repeatedly refused to release the excess RAM back into the pool. So it doesn’t work out as well in practice as it does on paper.
I would agree that 16GB is the bare minimum though and if you have less you absolutely should get more if you can. Firefox needs at least 8GB to run smoothly, but a system that only has that amount or less will be bogged down by Firefox alone.
I don’t know what to tell you, then. I’ve never had Firefox or chrome be that stubborn on a consistent basis. Are you using extensions? Some extensions are very poorly optimized, especially so when combined with certain websites (gotta love badly implemented JS in some places). Even if the extension is well made, they can still get overwhelmed sometimes, e.g. ublock origin on sites with very aggressive ads.
That being said, browsers are very complicated and the fact they all heavily use sandboxing now (as they rightfully should be), I guess I’m not surprised where they don’t function as intended in various use cases.
Even if the extension is well made, they can still get overwhelmed sometimes, e.g. ublock origin on sites with very aggressive ads.
Maybe that’s part of the issue, I’ve seen uBO say it blocked 8K+ ads on certain sites.
That being said, browsers are very complicated and the fact they all heavily use sandboxing now (as they rightfully should be), I guess I’m not surprised where they don’t function as intended in various use cases.
Yeah that’s very true, Browsers these days are becoming more like virtual machines. I guess it makes sense you wouldn’t give all your RAM to them just like you wouldn’t give all your computer’s main RAM to a Windows VM.
I guess with a small amount of tabs it can work better, but with 400 tabs and 12 extensions it definitely does struggle. When I first used the .desktop files to limit the ram I accidently set it at 1GB and everything started lagging and freezing in Firefox, it really didn’t like it. At least I learned that the RAM limiting method I found really did work because of that.
It’s only a problem if it doesn’t give it up when other apps need it and there’s not enough. Browsers just cache a bunch of shit in memory for speed and convenience, but they should unallocate it back to the pool if something else calls for it. The internet complaining about this for years and years are mostly doing so from a place of ignorance.
The issue is that browsers don’t release much memory back to the system when it’s needed. I wish they’d work more like the Linux kernel’s VFS caching later, but they don’t (and might not be able to. For example, I do don’t think the Linux kernel has good APIs for such a use case).
You can write limits to and then poll files in
/proc/pressure/
to be notified of resource pressure. Systemd will also set an environment variable for similar files for your cgroup.The issue is that browsers don’t release much memory back to the system when it’s needed. I wish they’d work more like the Linux kernel’s VFS caching later, but they don’t (and might not be able to. For example, I do don’t think the Linux kernel has good APIs for such a use case).
It does release it back to the system. It only doesn’t if you actively have a ton of windows/tabs open, in my experience. Even then, it’ll cache stuff to disk after awhile. Like on my phone, I’ve easily had over 20 tabs open in Firefox (Android) and it doesn’t suck up all of my phone’s ram (which only has 12GB). If your system is running less than 16GB, then that’s another matter and you really should add more, as 16GB is pretty much the baseline on computers these days.
Mine is 32GB and Firefox as consistently and repeatedly refused to release the excess RAM back into the pool. So it doesn’t work out as well in practice as it does on paper. I would agree that 16GB is the bare minimum though and if you have less you absolutely should get more if you can. Firefox needs at least 8GB to run smoothly, but a system that only has that amount or less will be bogged down by Firefox alone.
I don’t know what to tell you, then. I’ve never had Firefox or chrome be that stubborn on a consistent basis. Are you using extensions? Some extensions are very poorly optimized, especially so when combined with certain websites (gotta love badly implemented JS in some places). Even if the extension is well made, they can still get overwhelmed sometimes, e.g. ublock origin on sites with very aggressive ads.
That being said, browsers are very complicated and the fact they all heavily use sandboxing now (as they rightfully should be), I guess I’m not surprised where they don’t function as intended in various use cases.
Maybe that’s part of the issue, I’ve seen uBO say it blocked 8K+ ads on certain sites.
Yeah that’s very true, Browsers these days are becoming more like virtual machines. I guess it makes sense you wouldn’t give all your RAM to them just like you wouldn’t give all your computer’s main RAM to a Windows VM.
I’m on 4gb of ram right now (travelling so I’m away from my desktop) and firefox is using ~2gb I think (only 4-6 tabs open though)
I guess with a small amount of tabs it can work better, but with 400 tabs and 12 extensions it definitely does struggle. When I first used the .desktop files to limit the ram I accidently set it at 1GB and everything started lagging and freezing in Firefox, it really didn’t like it. At least I learned that the RAM limiting method I found really did work because of that.