Clean up swap memory

I'd recommend trying to track down what is using all the swap space...

Run top then press OoReturn (that's capital-o, lowercase-o)

That will order the listing by the amount of virtual memory space the processes are using. You can then see what it is that is consuming all your swap.


You could do this with the following:

swapoff /dev/sda2
swapon /dev/sda2

(assuming that /dev/sda2 is the location of your swap partition).

I'm not sure what the effect would be on system performance though while all swapped pages are moved back into physical RAM.


In newer versions, sudo swapoff -a and sudo swapon -a work instead.

Tags:

Ubuntu

Swap