14

My computer has only 4GB memory, and opening 8-12 random tabs on chrome or chromium often freezes my computer. Currently I'm using google-chrome-stable --process-per-site. This helps to some extent. Is there any way to run chrome or chromium in a single process? Could anyone give me some tips on how to control chrome's excessive memory usage?

  • Why do you feel Chrome is using more memory then it needs? Modern browsers would be extremely slow if they only used a single process. What makes you think Chrome would use less memory if it was only a single process? – Ramhound Aug 7 '15 at 11:11
  • I think one time I checked, I found IE was much much better in terms of memory footprint. IE was a joke for a while like V6-V9 or something until around v10 or v11. They say the current version isn't too bad. Take a look at it. Also look at Opera which was historically not too memory hungry.. Though I must say I just checked IE and in one of its instances it used 102MB.. which seems like a lot.. but anyhow, see if you find IE uses less than chrome. You could try very small browsers like "off by one" but they may not show all pages correctly. – barlop Aug 7 '15 at 13:04
  • Even though RAM is expensive, when you're low on RAM, more RAM is a good investment, pays off straight away! – barlop Aug 7 '15 at 13:10
  • 3
    Chrome by it's nature uses a lot of memory. The best way to save memory would be use another browser. – qasdfdsaq Aug 7 '15 at 14:12
  • As you do not specify, on linux you can have swap as compressed ram using zram, the package is zram-config. Helps on avoiding long freezes. – Aquarius Power May 11 '16 at 6:43
4

I am using cgroup this way:

sudo cgcreate -a $USER:$USER -t $USER:$USER -g memory:groupChromiumMemLimit
sudo cgset -r memory.limit_in_bytes=$((1024*1024*1024)) groupChromiumMemLimit
cgexec -g memory:groupChromiumMemLimit chromium-browser

The chromium itself may get somewhat slowed sometimes, as it seems to be swapping, but it will not make the whole system hang on swapping other applications, so just chromium/chrome will swap as soon it "reaches 1GB limit".

But... if you look at htop, you will see many chromium processes that sum the resident memory a bit beyond 1GB, I think I need more info on this.

havent tried yet memory.soft_limit_in_bytes to see if it helps in some way, as is suggested in the link provided by https://superuser.com/a/1168435/157532.

but overall, chromium is using much less RAM than it used to, and it is clearly being swapped a lot, so these cgroup commands are working despite of what I can see at htop, so cgroup seems to try to keep chromium using "not much more than 1GB" what is good enough.

| improve this answer | |
  • 1
    top shows memory usage in bytes, MB, GB or TB. These are powers of 1000 not 1024. That's probably why you're seeing it go slightly above your target. – jcoffland Dec 2 '18 at 10:50
  • Also, will this persist reboots? How does it compare with this solution that writes to /sys/fs/cgroup/memory/myGroup/memory.limit_in_bytes? – Dan Dascalescu Mar 10 at 12:18
  • 1
    @DanDascalescu btw, I think this doesnt work very well now... chromium spawns more than 15 independent threads and that limit would apply to each thread (and not a limit to them all like a group limit). I will try to find a way to create a limit that SUMs each thread and limit them all together (and not isolated like it seems to be right now). – Aquarius Power Mar 10 at 21:48
3

There is a plugin you could use to write memory of unused open tabs to swap. It releases that ammount of memory, so CHrome/chromium shows less memory consumption.

Search for Tab-suspender on the webstore of plugins.

https://chrome.google.com/webstore/detail/tab-suspender/fiabciakcmgepblmdkmemdbbkilneeeh

| improve this answer | |
1

I have the same issue, and I am not alone: Chrome/Chromium eats a lot of memory. Sometimes, this cause the system to freeze (in my case, Linux Mint 17).

solution 1

As a workaround I've started to use this Chrome-Extension: the-great-suspender

solution 2

But there are several other solutions, for example linux cgroup (https://gist.github.com/juanje/9861623)

other solutions

I have attached my other solutions to my first answer to similar question.

Anyway: Chrome is a good (probably best) web-browser, and sites today have high requirements (a lot of JS, canvas, SVG, embed video, web-sockets..). Trying to cut some of functionality - is not a good idea. The only one problem I am trying to solve (at least for me): nobody wants to sit near frozen system.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.