Linux 清理缓存的办法 ( free memories in linux)

访问量: 1183

1. 查看当前的内存状态: $free -m   (   check current memory usage ) 

或者 使用 $top , 然后 c, 1  ( or $top, press c, 1 ) 

2. $ sync 

3. $ echo 3 > /proc/sys/vm/drop_caches 

Before free:

root@li539-250:/opt/app/siwei/wawa_site/config# free -m
             total       used       free     shared    buffers     cached
Mem:          4000       3661        338          0        964        909
-/+ buffers/cache:       1787       2212
Swap:          499          0        499

After free: (可以看出, 释放了2G的内存)  

root@li539-250:/opt/app/siwei/wawa_site/config# free -m
             total       used       free     shared    buffers     cached
Mem:          4000       1697       2303          0          2         38
-/+ buffers/cache:       1655       2344
Swap:          499          0        499

订阅/RSS Feed

Subscribe

分类/category