My ubuntu 18.04 64bit isn't using the swap file/partition to the point when the 8gigs(of which 7.3 are usable) of ram almost fills up, and when it does, and actually writes some things in swap it freezes/becomes unresponsive after a couple of hundreds of MB, usually when 750MB+ is written into swap.

I have googled similar problems and so far tried a few different things but nothing works.

This happened on another Ubuntu install on the same machine that had a 2GB swap partition created by the installer automagically, it happened on the current Ubuntu install where I allocated 15G of space for a proper swap partition, and again when I created a 5G swap file.

I also tried increasing swappiness from the default 60 to 80, but still, Ubuntu doesn't use the swap until I reach the 6-7G mark of used ram, and then if I'm lucky I can navigate with alt-tab and restart the computer, sometimes if it's really bad the mouse stops responding, other times the mouse clicks do absolutely nothing inside open windows(it does close the windows occasionally, and can navigate through web pages using the keyboard), waiting for minutes usually is futile, and if it freezes completely I can only restart using REISUB.

Any ideas?

Edit: i will try the suggestions in the comments. I already tried decreasing the swappiness to 15 as suggested, And I haven't experienced freezes since, although I was only able to fill the ram twice since(probably somethings leaks memory in the long run) - it wasn't much in the swap only 35-175MB.

  • Do you run virtual machines? What is filling up your ram? Did you check if your ram is faulty? – danzel Dec 6 '18 at 13:42
  • Yes I have multiple win and android vm-s on this machine, but I only run 1 at a time(i don't run it nonstop), with 1-2gb of ram. And in that case it's more likely that the vm will crash, than the freeze occurring. Firefox eats a lot of ram, but I always have multiple tabs open in multiple browsers, and also multiple applications open alongside it. Sometimes more than 1 firefox tab is streaming audio or video. – D. Dan Dec 6 '18 at 13:59
  • If you are running a lot of applications at once and none of them can be swapped out because they are in use constantly, then this behaviour is probably to be expected. I had similar problems a few weeks ago and my solution was upgrading my ram to 16GB. Remember, swap is not a ram extension. If essential parts like the desktop environment have to be swapped out due to lack of free ram, the system will become unresponsive. BTW, typically the host system starves (freezes) before the VM crashes. – danzel Dec 6 '18 at 14:20
  • Do you use Google Chrome with a lot of tabs open? Every tab you open in Google Chrome is a new instance and takes almost just as equal amount of RAM as the last one did. Try installing inxi on the host then run inxi -t m20 to show you the top 20 memory hogs of the system. The idea is to avoid needing to use swap on the system. Also look into settings for vm.swappiness on your system to a lower number like 10 or 1 as well to try to avoid it as much as possible. The higher the number the more swapping happens. 60 means when the ram hits 40% to swap. – Terrance Dec 6 '18 at 14:31

Your Answer

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

Browse other questions tagged or ask your own question.