Skip to content

Instantly share code, notes, and snippets.

@fdln
Forked from ekinertac/purge.sh
Created January 8, 2014 17:02
Show Gist options
  • Save fdln/8320240 to your computer and use it in GitHub Desktop.
Save fdln/8320240 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Free unused memory
flush_mem () {
sync
echo 3 | 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