2011-02-14

[Linux] 釋放虛擬記憶體

Linux Kernel 2.6.16 之後新加入了 drop caches 的機制,可以讓系統空出大量的記憶體

Freeing the page cache:
$ echo 1 > /proc/sys/vm/drop_caches
$ sysctl -w vm.drop_caches=1


Free dentries and inodes:
$ echo 2 > /proc/sys/vm/drop_caches

Free the page cache, dentries and the inodes:
$ echo 3 > /proc/sys/vm/drop_caches

這使 kernel 更勤於回收 cache
$ sysctl -w vm.vfs_cache_pressure=n (n > 100)

Tsung's Blog - Linux 手動回收 已經被 Cache 的記憶體

沒有留言 :

張貼留言