centos中释放缓存的方法
释放缓存区内存的方法 a)清理pagecache(页面缓存) # echo 1 > /proc/sys/vm/drop_caches 或者 # sysctl -w vm.drop_caches=1 b)清理dentries(目录缓存)和inodes # echo 2 > /proc/sys/vm/drop_caches 或者 # sysctl -w vm.drop_caches=2 c)清理pagecache、dentries和inodes # echo 3 > /proc/sys/vm/drop_caches 或者 # sysctl -w vm.drop_caches=3 [root@test4_haili_dev hadoop-2.7.3]# free -m total used free shared buffers cached Mem: 7809 7159 650 0 324 2444 -/+ buffers/cache: 4390 3419 Swap: 511 89 422 [root@test4_haili_dev hadoop-2.7.3]# cat /proc/sys/vm/drop_caches 1 [root@test4_haili_dev hadoop-2.7.3]# echo 1 > /proc/sys/vm/drop_caches [root@test4_haili_dev hadoop-2.7.3]# free -m total used free shared buffers cached Mem: 7809 4345 3464 0 0 36 -/+ buffers/cache: 4308 3500 Swap: 511 89 422 [root@test4_haili_dev hadoop-2.7.3]# cat /proc/sys/vm/drop_caches 1 [root@test4_haili_dev hadoop-2.7.3]# echo 2 > /proc/sys/vm/drop_caches [root@test4_haili_dev hadoop-2.7.3]# cat /proc/sys/vm/drop_caches 2 [root@test4_haili_dev hadoop-2.7.3]# free -m total used free shared buffers cached Mem: 7809 4303 3506 0 2 36 -/+ buffers/cache: 4265 3544 Swap: 511 89 422 [root@test4_haili_dev hadoop-2.7.3]# cat /proc/sys/vm/drop_caches 2 [root@test4_haili_dev hadoop-2.7.3]# echo 3 > /proc/sys/vm/drop_caches [root@test4_haili_dev hadoop-2.7.3]# free -m total used free shared buffers cached Mem: 7809 4301 3508 0 0 36 -/+ buffers/cache: 4264 3544 Swap: 511 89 422