Frequent file access can result in a large cache usage and slow system operation.
1 First Use the free command to view memory usage:
$ free-m
Total used free shared buffers Cached
mem:3955 3926 28 0 55 3459
2 run sync to write the contents of dirty back to the hard drive
$sync
3 Clean the free cache by modifying the drop_caches of the proc system
$echo 3 >/proc/sys/vm/drop_caches
Detailed documentation on Drop_caches is as follows:
Writing to this would cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become Free.
To free Pagecache:
* Echo 1 >/proc/sys/vm/drop_caches
To free dentries and inodes:
* Echo 2 >/proc/sys/vm/drop_caches
To free Pagecache, dentries and Inodes:
* Echo 3 >/proc/sys/vm/drop_caches
As this is a non-destructive operation, and dirty objects was not freeable, the user should run ' sync ' first in order to M Ake sure all cached objects is freed.
Reference documents:
[1] Reprint address: http://m.blog.csdn.net/article/details?id=4336075.
Go Linux Cleanup Cache method