2018-06-21 22:49:50 -05:00

14 lines
262 B
Bash
Executable File

#!/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