-
-
Save monodeep12/407c38c10ba9eae3bc8a to your computer and use it in GitHub Desktop.
Free up unused memory [ubuntu]
This file contains 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 | |
# | |
# Release memory used by the Linux kernel on caches. | |
free -m | |
sudo sysctl -w vm.drop_caches=3 | |
sleep 5 | |
sync && echo 3 > sudo /proc/sys/vm/drop_caches | |
free -m | |
# 1 -> to free pagecache | |
# 2 -> to free dentries and inodes | |
# 3 -> to free pagecache, dentries and inodes | |
# | |
# Reference: http://www.commandlinefu.com/commands/view/2888/release-memory-used-by-the-linux-kernel-on-caches | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment