On Thursday 18 December 2008 17:16:10 FreeBSD wrote:
> Hi everyone,
> I have a FreeBSD 7.0-Release server that started to swap after an error
> in a shell script (process spawning competition ;-) ). I killed the
> shell and the RAM is now OK. The problem is that the swap is still used.
> How can I "reset" the swap?
> Thanks for sharing your knowledge,
> Martin

# swapoff -a ; swapon -a

It just removes all swap devices (with the content mapped back into memory) 
and then turns the swap devices back on.

Just make sure you have enough RAM to run your system while it does this 
(since only the RAM will be available for the system [NO SWAP])!!!  
WARNING: This could kill your system and does eat babies!!!

To others: There is one reason I can think of for doing this, if an 
irregularly used program (that is rather big) has been swapped out but 
requires a low latency when used (i.e. must not wait to be swapped back 
in...) then it would be desired to get the program swapped back into RAM as 
soon as possible after RAM has been freed.  



Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to