Free Linux Memory by Dropping Caches

来源:互联网 发布:类似纳米盒的软件 编辑:程序博客网 时间:2024/05/21 07:10
Linux Kernels 2.6.16 and up provide a way to instruct the kernel to drop the page cache, inode and dentry caches on command. This tip can help free Linux memory without a reboot.

Note: This is a non-destructive operation. Dirty objects are not freeable, hence; you must run sync beforehand.

To use /proc/sys/vm/drop_caches, you simply echo a number to it.

To free pagecache:


Code:
# sync; echo 1 > /proc/sys/vm/drop_caches

To free dentries and inodes:


Code:
# sync; echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:

Code:
# sync; echo 3 > /proc/sys/vm/drop_caches
0 0
原创粉丝点击