How do I flush swap?

Nils Kassube kassube at gmx.net
Sun Jan 20 09:19:27 UTC 2008


Nigel Ridley wrote:
> Q. How do I flush/clear the swap file which is still showing a chunk in
> use?

Is there a reason why you want to flush the swap space? If something is 
loaded into memory but not in use, there is no problem to have it kept in 
the swap space. If you would get it back into memory now and need some 
more memory for applications later, the kernel will possibly save the 
same part of the memory in the swap space. That would cost more disk 
activity overall.

Anyway, if you think it is a good idea, you can always turn off swap with 
the command

sudo swapoff -a

and after that turn it on again with this command:

sudo swapon -a



Nils




More information about the kubuntu-users mailing list