Pages

Monday, March 19, 2012

Cleaning Memory on Linux

If your system shows a lot of inactive memory or Swap space in use and you wish to cleanup before starting next job, then here is what you can do:

$ sync

# Cleanup memory held-up in Inactive and return to Unused, also removes unused pages/inodes/delentries from used memory
$ echo 3 > /proc/sys/vm/drop_caches

# Empty used up Swap space
# Disable swap and then re-enable
# This method is an aggressive one and if there isn't enough RAM free to hold up required pages from Swap, the system may crash
$ /sbin/swapoff -a
$ /sbin/swapon -a




No comments:

Post a Comment