释放内存中不需要的东西 (Kernerl 2.6.16或更新)

sync && echo 1 > /proc/sys/vm/drop_caches

sync:强迫将已更改的数据写入磁盘,并更新超级块!!!

释放 pagecache:

echo 1 > /proc/sys/vm/drop_caches

释放 dentries and inodes:

echo 2 > /proc/sys/vm/drop_caches

释放 pagecache, dentries and inodes:

echo 3 > /proc/sys/vm/drop_caches