首页 > 代码库 > 如何释放linux cache占用的内存

如何释放linux cache占用的内存

[root@prd-fygl-app-01 ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          3792       3663        128        184        148       3003
-/+ buffers/cache:        511       3280
Swap:            0          0          0

[root@prd-fygl-app-01 ~]#  cat /proc/sys/vm/drop_caches
0

[root@prd-fygl-app-01 ~]# sync

[root@prd-fygl-app-01 ~]# echo 3 > /proc/sys/vm/drop_caches
[root@prd-fygl-app-01 ~]#  cat /proc/sys/vm/drop_caches
3

[root@prd-fygl-app-01 ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          3792        395       3397        184          2         19
-/+ buffers/cache:        372       3419
Swap:            0          0          0

 

如何释放linux cache占用的内存