# sync && echo 3 >/proc/sys/vm/drop_caches && sleep 2 && echo 0 >/proc/sys/vm/drop_cachesfree -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.