3 ms·
I saw a trick where you can run Chrome and give it less memory, and it uses less memory. This is done using cgroups. The blog post is somewhat old[1] and not
by yebyen 10y ago
I saw a trick where you can run Chrome and give it less memory, and it uses less memory. This is done using cgroups.
The blog post is somewhat old[1] and not in sync with the version that is in Git[2], you might find a way to do this without Docker (I was using an old version of Docker and kernel that couldn't get it to work. But I need the old version of Docker for reasons.)
Chrome will aggressively consume any memory you give it (up to a point?) to "make your browsing experience better" somehow. You're not wrong. But there is modern technology that can make it better. If you have a fast SSD, then Chrome can still use Swap to make your experience better. The later version in the Dockerfile linked on Git also leverages swapaccount with the seccomp setting.
This may be one great use of Docker for people that wouldn't yet have been convinced to use Docker for any serious reason.
[1]: https://blog.jessfraz.com/post/docker-containers-on-the-desktop/#5-chrome https://blog.jessfraz.com/post/docker-containers-on-the-desk...
[2]: https://github.com/jessfraz/dockerfiles/blob/master/chrome/stable/Dockerfile https://github.com/jessfraz/dockerfiles/blob/master/chrome/s...
- tayo42 10y agoYou can just use cgroups on their own without docker
- tyingq 10y agoI would guess ulimit -v might work as well, so you may not even need cgroups.
- yebyen 10y agoHah! Something new is also something old. Thanks for that. But won't you run into issues with child processes, of which Chrome tends to spawn a zillion? (I'm reading that each one gets its own limit under ulimit...) And potentially get your browser killed when it hits the limit? I haven't tested this and I don't really know how ulimit works, but I think it's a less effective solution than the cgroups for at least one reason.
- tyingq 10y agoYes, it is per process, so it would only limit memory-per-tab. I believe you get the "aw snap" window in chrome if it hits the limit.