2

I have a piddly 2GB of RAM in my 8 or so year old laptop and Chrome really likes to use all of it. Is there some way to control how much memory either all of Chrome or specifically its memory cache uses?

To be doubly clear, I am not asking about any disk caches.

If the answer is that I should have 'just Googled it', then please tell me what you searched for so that I can improve my Google-fu.

1

2 Answers 2

1

I don't think there is a way to set a hard limit on RAM usage. If you think about it, what would Chrome do when you hit the limit? Close pages? Not allow you to do anything else?

Instead of a hard limit there are ways to manage the RAM usage manually. You can use the Task Manager (Shift+Esc) to find pages that are sucking up RAM the most and close them. There is also a hidden Purge function that you can turn on by adding

--purge-memory-button

as an argument to the Chrome shortcut. After you launch with this command line argument you will have a Purge Memory button in the Task Manager that should free up RAM if you're running low.

You can read more about this here.

3
  • Thanks. At some point I will have to figure out exactly what this button does, but at least it shows up. I feel like I saw reference to this awhile ago before it made it into the Chrome releases.
    – altendky
    Sep 10, 2010 at 1:37
  • From what I understand the button "re-evaluates" memory demands. Lets say for instance you had a page with lots of images open in one of the tabs. You then navigated to google.com within that same tab. Even though google.com takes up a lot less memory than a page full of pictures the tab still keeps the memory it reserved. So now google.com is taking up the same amount of RAM as that page full of pictures. What the Purge button does is it has Chrome evaluate how much memory is needed for open pages and releases memory that is not needed anymore.
    – Marcin
    Sep 10, 2010 at 6:38
  • This is a good way to reclaim the memory without having to close the tab and open another page in a new tab. The way Chrome works is apparently it will ask for more memory when it needs it but it does not release memory it already has unless you close the tab or window. (Or obviously use this Purge function).
    – Marcin
    Sep 10, 2010 at 6:41
0

If you want to strictly limit memory usage you should use kernel feature called cgroups or specifically memory cgroup.

Official documentation: https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt and https://www.kernel.org/doc/Documentation/cgroup-v2.txt (more information about cgroups can be found at https://www.kernel.org/doc/Documentation/cgroup-v1/)

Here's an example for Ubuntu Linux: http://www.fernandoalmeida.net/blog/how-to-limit-cpu-and-memory-usage-with-cgroups-on-debian-ubuntu/ (I think Ubuntu still uses v1 interface to cgroups.)

The memory cgroup really forces memory limit unlike setting any ulimit configuration which is the closest feature if you need compatibility with systems without recent enough Linux kernel.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .