Thursday, December 20, 2012

How to clear cached memory on linux


Since 2.6.16 you need only echo to clear cached memory on Linux box.

This will clear all cached memory.

echo 3 > /proc/sys/vm/drop_caches
You can clear only part of it by using 1 or 2. All options:

  • 1 to clear cached pages.
  • 2 to clear dentries and inodes. 
  • 3 to clear all cached memory.

Links:
I found this advise here
Some notes about Linux VFS
Linux Page cache