Skip to content

Instantly share code, notes, and snippets.

@1901
Last active July 1, 2019 12:11
Show Gist options
  • Select an option

  • Save 1901/b0d5376c7c7726ee258d6ad4f96fcf4a to your computer and use it in GitHub Desktop.

Select an option

Save 1901/b0d5376c7c7726ee258d6ad4f96fcf4a to your computer and use it in GitHub Desktop.
[linux_clear_memory_cache] #linux
# 1. Clear PageCache only.
sync; echo 1 > /proc/sys/vm/drop_caches
# 2. Clear dentries and inodes.
sync; echo 2 > /proc/sys/vm/drop_caches
# 3. Clear PageCache, dentries and inodes.
sync; echo 3 > /proc/sys/vm/drop_caches
# If you want to clear Swap space, you may like to run the below command.
swapoff -a && swapon -a
# ref: https://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment