Saturday, April 11, 2009

linux mm drop caches

Kernels 2.6.16 以後的版本, 可藉由以下指令釋放出 Caches 佔住的記憶體

# echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:

# echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:

# echo 3 > /proc/sys/vm/drop_caches
As this is a non-destructive operation and dirty objects are not freeable, the user should run "sync" first!

ref. Drop Caches - linux-mm.org Wiki ( http://linux-mm.org/Drop_Caches )