1

This is what it looks like on top:

enter image description here

To get that free memory I had to kill Android Studio. Chrome is definitely using the most memory, but also Firefox. I keep both open most of the day doing different things. I've been doing that plus Android Studio for years and never had an issue until recently. The only thing I've changed recently is I upgraded to Ubuntu 18.10. I noticed the buff/cache is really high, should it really be using that much when I'm running out of memory for applications and having to swap?

Edit: In the end it turned out that I had a couple of problems. The swap file was tiny but once I fixed that it would just take longer to run out of memory. Then I found out the Google Play Music Chrome extension was using a lot of memory, removing it fixed the issue.

14
  • You might look at some of the techniques in https://unix.stackexchange.com/questions/253816/restrict-size-of-buffer-cache-in-linux – Charles Green Dec 12 '18 at 16:43
  • Your swap space is too small. And the parameter vm.swappiness may need to be tweaked. The buff/cache is used as file/disk cache when available. – heynnema Dec 12 '18 at 17:06
  • @CharlesGreen thanks for the link, going to play with those values. – casolorz Dec 12 '18 at 17:13
  • @heynnema yeah just noticed that about my swap space, it has been like that for a while but I'll see if I can increase it. Still seems odd that it would prefer to swap rather than free up some ram on the buff/cache. – casolorz Dec 12 '18 at 17:14
  • Hence my comment about tweaking vm.swappiness. – heynnema Dec 12 '18 at 17:17
1

From the comments...

Your 2G swap space is too small. And the parameter vm.swappiness may need to be tweaked. The buff/cache is used as file/disk cache when available.

You thought the system was using a 22G swap partition, but instead it was using a 2G swapfile. You've enlarged that, and so far it's working well. I'd recommend about a 8G swapfile.

The parameter vm.swappiness can be changed from its default of 60, to 10, to see if that improves the ratio of main memory vs swap and disk/file cache. Edit /etc/sysctl.conf and add vm.swappiness=10, and then reboot.

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.