1
1
I am software developer, and every now and then I will accidentaly use up all the available RAM with one of my programs. The OS will helpfully swap-out everything else I may be using at the time (i.e. web browser, development IDE, audio player, etc.). After I manage to kill my malfunctioning program, other software running on my machine is close to unusable for a couple of minutes, and it will not swap-back on it's own without me actually using the software (and waiting long seconds after each click). I can just sudo swapoff -a
to force all the memory pages back into RAM, but that takes surprisingly long. I can monitor the swap usage using the free
command. The swap is emptied at about 1-2MB/sec -running the free
every couple of seconds shows only a single-digit difference, and the whole process can take couple of minutes.
My system is fairly new, and I just tested the HDD that stores the swap partition with cpipe
- reading 7GB file averages around 150-160MB/sec. Why isn't the swap moved back to the ram with similar speed?
Is there anything I can do to make it faster?
$ uname -r
4.15.0-29-generic
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
Release: 16.04
Codename: xenial
Do a
sudo atop 1
the next time this happens. I've had similar issues, and it turns out several daemons get hyperactive when switching from swap back to real memory. – barrycarter – 2018-08-08T17:16:03.507