Linux: Free up virtual memory without rebooting

Published by

Posted on May 01, 2018

Found some interesting commands to free up some virtual memory without a reboot. I did not think the command will work so i ran a test in the lab and sure enough. It works like a charm.

just so you can see real time stats

sync; echo 1 > /proc/sys/vm/drop_caches

To clear inodes
sync; echo 2 > /proc/sys/vm/drop_caches

To clear free memory
sync; echo 3 > /proc/sys/vm/drop_caches

Path to drop caches file /proc/sys/vm/drop_caches