Clear RAM Cache

From Michael's Information Zone
Jump to navigation Jump to search

My Fedora workstation would have it's RAM filled with disk cache over time, but would not clear it as space was needed. My SSD would start getting hammered as SWAP would be used to compensate. Though normally this process would not be needed, and I do not recomend this on a server, but I do some crazy things on my workstation. [1]

  • sync; echo 1 > /proc/sys/vm/drop_caches
  • sync; echo 2 > /proc/sys/vm/drop_caches
  • sync; echo 3 > /proc/sys/vm/drop_caches

These are the options, but the first one is the safest to use. Also keep in mind that this must be run as root, and the redirection causes issues if your running with sudo. [2]To compensate you can run

sudo sh -c "/usr/bin/echo 1 > /proc/sys/vm/drop_caches"