歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> linux如何釋放cache

linux如何釋放cache

日期:2017/3/1 14:02:19   编辑:關於Linux
linux如何釋放cache [root@master ~]# free -m total used free shared buffers cached Mem: 2009 1999 9 0 1308 437 -/+ buffers/cache: 253 1756 Swap: 5951 0 5951 [root@master ~]# cat /proc/sys/vm/drop_caches 0 [root@master ~]# echo 3 > /proc/sys/vm/drop_caches [root@master ~]# cat /proc/sys/vm/drop_caches 3 [root@master ~]# sync [root@master ~]# free -m total used free shared buffers cached Mem: 2009 463 1545 0 176 49 -/+ buffers/cache: 236 1772 Swap: 5951 0 5951 有關/proc/sys/vm/drop_caches的用法在下面進行了說明 /proc/sys/vm/drop_caches (since Linux 2.6.16) Writing to this file causes the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free. To free pagecache, use echo 1 > /proc/sys/vm/drop_caches; to free dentries and inodes, use echo 2 > /proc/sys/vm/drop_caches; to free pagecache, dentries and inodes, use echo 3 > /proc/sys/vm/drop_caches. Because this is a non-destructive operation and dirty objects are not freeable, the user should run sync(8) first.
Copyright © Linux教程網 All Rights Reserved