
On Fri, Dec 25, 2020 at 02:38:16PM +1100, Tim Connors wrote:
`ulimit -v` doesn't work very well for multithreaded applications to limit their memory usage because it just spawns off more processes when it wants to hog more resources, and any limit I've found to stop it crashing my machine are unrealistically small per process and stops legit tabs from running.
How, as an unprivledged user on debian, do I put mozilla into its own cgroup limiting its memory usage to ~ 50% of real memory (16GB ought be enough for 3 tabs these days, eh?).
firejail might be able to do it, although it seems that its '--rlimit' option has been rermoved. firejail is setuid root so doesn't need sudo. worth looking into, anyway. or there may be other programs which allow control group containerisation for unpriviledged users. another possibility is to run a VM for firefox, and limit the VM's memory. Should work OK for most sites, but badly for sites like youtube that want hardware video acceleration. Dunno if there's any easy way to create a VM as an unprivileged user with KVM but it is possible for root to set one up and allow a user to run it. Virtual Box is intended for use by unpriviledged users. Also, here's a reddit thread on this topic from earlier this year. most of the suggestions require sudo. https://www.reddit.com/r/linuxadmin/comments/fbfc6w/how_to_wrap_my_firefox_p... craig ps: the single best way to reduce browser bloat is to install ublock origin and umatrix (or other ad blocker and javascript controller). fucking ads and shitty javascript are responsible for most browser memory and other resource wastage. for those javascript-encrusted sites that you can't avoid for whatever reason, occasionally killing the tab/window and restarting it can help to regain leaked memory. pps: final alternative: buy more RAM. You owe it to the advertisers and other spies. After all, they're the real owners of your PC. -- craig sanders <cas@taz.net.au>