Skip to content

Instantly share code, notes, and snippets.

@lordloh
Last active August 22, 2018 00:02
Show Gist options
  • Save lordloh/c0be685caa82cbb0b68301c583f6f8dd to your computer and use it in GitHub Desktop.
Save lordloh/c0be685caa82cbb0b68301c583f6f8dd to your computer and use it in GitHub Desktop.
This is a script I use to free up memory on my system. It syncs all IO buffers to disk, then instructs the kernel to drop all caches. However, caches exist for a reason. Manually clearing them will temporarily degrade application performance.
#! /bin/bash
free -m
sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"
free -m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment