1

Having a 32-bit system with 4G RAM and 7G swap. Linux 3.5.0-49-generic i686.

From time to time the memory bank is filled up and everything lags down. In 99% of the cases it is Chrome using vast amounts of RAM and swap. Some times it helps to close down some windows, but often not. As an example for last time:

Mem: 4G in use
Swp: 3G in use

Chrome: 4 windows, 17 tabs.

Closing Chrome and after a while I sit with

Mem: 450M in use
Swp: 220M in use

This is a rather typical scenario. The pages are "normal" web-pages like Stack Exchange sites, some articles and perhaps a news-site or two.


One thing I notice is that it takes some time for the system to normalize after I shut Chrome down. This is long after last process has died according to htop / top. It keeps lagging etc. Guess this is due to the swap.

My question is if it is advisable to use some technique to flush the swap (push it to RAM so to speak), and how. And, is there some other technique to help in this particular predicament?


Edit: As for extensions I only use

  • Vimium, which usually does not consume much.
  • Session Buddy, (so that I can save my tabs when I need to do a Chrome boot), but this one also use (relatively) little memory. Even so I usually have it disabled and only enables it before I do a shut down and when I want to restore some of the tabs from a previous session.
  • Flashcontrol

I have also tried longer periods with no extensions, not that it helped.

When it comes to extensions/plugins the worst culprit is flash. Using Flashcontrol this helps somewhat, but all over the issue persist.

I usually check this using Chrome's own Task Manager, Shift+Esc

  • Your solution is probably going to be in the area of modifying cgroup's swappiness value. If Chrome is using too much memory and it's slowing the rest of the system down, you might try to increase chrome's swappiness which will slow Chrome down but make more physical memory available to the other applications. – Bratchley Jun 04 '14 at 21:06
  • @JoelDavis: Thanks. I'll check this out. It is going to take some time to test. – user129107 Jun 04 '14 at 21:30
  • My horrible, horrible work around to keep Chrome reasonable is to bring up Chrome's built-in Task Manager and kill processes for Tabs I am not using. I can later reload those tabs and get them back without the hassle of completely closing and reopening Chrome all the time. – penguin359 Jun 04 '14 at 22:04
  • I note that I use Chrome much more heavily at work (8 windows with 20+ tabs each is common) and it doesn't use that much memory, which prompts me to wonder if something is wrong with your Chrome (or if you have an extension installed with a vicious memory leak or something). – ToxicFrog Jun 04 '14 at 23:09
  • @penguin359: Sounds like you might want to check out "The Great Suspender" extension. I do not use it myself as I found it halted my workflow too much. – user129107 Jun 05 '14 at 14:30
  • Where is chrome's cache kept? In ~/.cache is the default i think - is that where yours is? What sort of filesystem does that reside on? There are command-line flags for controlling cache size/location in chrome such as --disk-cache-{dir,size}=... You should try relocating that to a size-limited tmpfs mount. And, honestly, w/ 4gbs of RAM i cant understand why you would want a swap at all if not for hibernation. – mikeserv Jun 05 '14 at 16:54

2 Answers2

0

I don't know if swap could be handled, but I suggest not to touch it because mostly it is for a memory overtake, is like an emergence memory backup for your machine.

I suggest to remove chrome & install it again, you might have some plugins, add-ons you mustn't want, otherwise, analyze this extra stuff in your chrome & remove all you doesn't need.

tachomi
  • 7,592
  • Thanks. Added an update on extensions etc. Guess I could try a purge and re-install, if something should be out of whack. This is going to take some time to test though. – user129107 Jun 04 '14 at 21:24
0

Linux will not opportunistically move data from swap back into RAM before it actually needs to; otherwise, things would go much slower, as any freed page of RAM would result in it having to read a page of swap as well (until swap was empty).

If you want to force it to move everything left in swap back into RAM, you can temporarily disable swap with the swapoff command (don't forget to turn it back on with swapon afterwards!). Bear in mind that while this is running, the system will be nearly unusable as it drags everything back into memory.

You are probably better off just leaving it alone and letting it move things back into memory when and as needed.

ToxicFrog
  • 238