3

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.

D. Dan
  • 133
  • Do you run virtual machines? What is filling up your ram? Did you check if your ram is faulty? – danzel Dec 06 '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 06 '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 06 '18 at 14:20
  • 1
    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 06 '18 at 14:31
  • See: https://askubuntu.com/questions/103915/how-do-i-configure-swappiness – Terrance Dec 06 '18 at 14:38
  • I switched to Ubuntu from Windows because it was incredibly slow compared to Ubuntu. I just can't understand how it can not swap anything until the point when it swaps the desktop - that's some pretty stupid behavior. Windows uses swap all the time, and it's use is typically twice the ram used. If the only solutions to this problems are: use less stuff, buy more ram or buy faster hardware to run windows, that is pretty disappointing. Terrance, you should read again the OP question. – D. Dan Dec 06 '18 at 14:46
  • I run a system with 8GB of RAM and I don't experience this. I run a swappiness of 10. Swap is ALWAYS slower than RAM because it uses hard drive. I did read it. I don't think you understand how it works. – Terrance Dec 06 '18 at 14:54
  • How I understand is the bigger the swappiness more likely is Ubuntu to use the swap. I tried to increase it because I want the system to became more slower and slower by using more swap, and not to freeze, when it's almost out of ram. Maybe that's not how Ubuntu works, but to slowly try to move things from the ram to swap is something I would expect from an OS. Nevertheless, I'll try decreasing it also. – D. Dan Dec 06 '18 at 15:01
  • You might also want to see https://serverfault.com/questions/305295/why-does-windows-2008-use-swap-before-the-memory-is-full – Terrance Dec 07 '18 at 02:05

0 Answers0