Created
June 6, 2012 20:32
-
-
Save Gen2ly/2884577 to your computer and use it in GitHub Desktop.
Free unused memory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Free unused memory | |
flush_mem () { | |
sudo sync | |
echo 3 | sudo tee /proc/sys/vm/drop_caches | |
} | |
echo -e "\nMemory usage before purge:\n" && free -m | |
flush_mem || exit && echo " Error purging memory" | |
echo -e "\nMemory usage after purge:\n" && free -m | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment