2

I have changed to a swappiness of 10 on my 17.10 VM which I use for development, so I'm generally running a couple terminals, a browser, an editor, etc. I've been trying to track down leaks that consume all the RAM/SWAP.

I think I have that sorted out, but have noticed now (even after rebooting) that once the system starts using SWAP, even if I close all open apps (except terminal) and watch my RAM usage drop below 80% of the available 4GB, SWAP usage doesn't drop. At present, SWAP consumption has remained at nearly 20% of the 1GB available. I realize rebooting would free it up, but...

Is this expected?

Does the fact that SWAP is not freed indicate it was consumed by leaked memory?

What steps should I take next?

  • 1
    Things will only be read back out of swap if it's actually needed. If it's swapped out and not needed, that's just great - more memory for stuff that you actually use. I have not ever bothered with the swap; Linux is quite good at memory management in most cases. – vidarlo Nov 10 '17 at 12:43
  • I’m asking more about why the swap wasn’t freed when I exited the programs and RAM usage dropped below 80%. One thought that occurred to me is perhaps Gnome got swapped out? When I can, I’ll check to see what happens when I log out. – tim.rohrer Nov 10 '17 at 18:38
  • The stuff that is swapped out first is the stuff that isn't in use. There's no reason to read them back into memory unless they're actually needed. Why are you worrying about swap usage? Do you expirience slowness? If not, ignore swap. Don't look at it, don't think about it. – vidarlo Nov 10 '17 at 19:38
  • Please have a look at this answer. – vidarlo Nov 10 '17 at 19:39
  • I have experienced issues with leaks which have consumed all RAM and SWAP, and have brought my VM to its knees. I think I've got those resolved, although I haven't tried running Atom again, although I'd like to. I read the answer you linked, and while it is interesting, it doesn't seem to answer my question; namely, how does the kernel free up swap space when the application that first had data put there is no longer running? Most of the discussion I'm seeing here is about how data in SWAP is returned to a running application. – tim.rohrer Nov 11 '17 at 04:18

0 Answers0