8
2
I am using ubuntu 10.10. My RAM is 3GB and swap memory is 2GB. After using my system for several hours, all of my swap memory is used up. Is there any way so I can clean up swap memory?
8
2
I am using ubuntu 10.10. My RAM is 3GB and swap memory is 2GB. After using my system for several hours, all of my swap memory is used up. Is there any way so I can clean up swap memory?
6
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.
This is not a solution. If something is using swap space, removing swap leave the process in the cold, wanting more memory. The answer is, as Majenko mentions - find the application using swap. In "normal" usage "free -h" should show swap with 0 bytes used. – Daniel – 2015-03-05T21:48:23.017
8
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.
This is great. I often have problems of putting Ubuntu to hibernate, because the swap space is too loaded. Using this, I was able to track down the process, killed it and everythings works now. Thank you. – mpaepper – 2013-01-16T19:19:22.280
2
In newer versions, sudo swapoff -a
and sudo swapon -a
work instead.
Is there a specific problem this is causing, or do you just hate the numbers? – Ignacio Vazquez-Abrams – 2011-04-17T02:31:35.980
@abrams: my cpu usage goes to 100% frequently. i don't know what is the cause. so i am checking out everything to narrow the options – user – 2011-04-17T02:35:57.970
4That would not be caused by the swap. – Ignacio Vazquez-Abrams – 2011-04-17T02:39:16.143