# sync && echo 3 >/proc/sys/vm/drop_caches && sleep 2 && echo 0 >/proc/sys/vm/drop_caches
 
free -m

各参数含义:

   1:  total:总物理内存
   2:  used:已使用内存
   3:  free:完全未被使用的内存
   4:  shared:应用程序共享内存
   5:  buffers:缓存,主要用于目录方面,inode值等
   6:  cached:缓存,用于已打开的文件
   7:  -buffers/cache:应用程序使用的内存大小,used减去缓存值
   8:  +buffers/cache:所有可供应用程序使用的内存大小,free加上缓存值
   9:  其中:
  10:  total = used + free
  11:  -buffers/cache=used-buffers-cached,应用程序真实使用的内存大小
  12:  +buffers/cache=free+buffers+cached,服务器真实还可利用的内存大小 

 

Writing to this file causes the kernel to drop clean caches,dentries and inodes from memory, causing that memory to becomefree.
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 first.

转自 http://www.linuxidc.com/Linux/2012-04/58184.htm