⇤ ← Revision 1 as of 2006-04-27 12:23:42
572
Comment: basic documentation for /proc/sys/vm/drop_caches since this is a big FAQ
|
679
|
Deletions are marked like this. | Additions are marked like this. |
Line 3: | Line 3: |
To use `/proc/sys/vm/drop_caches`, just echo echo a number to it. | To use `/proc/sys/vm/drop_caches`, just echo a number to it. |
Line 19: | Line 19: |
As this is a non-destructive operation and dirty objects are not freeable, the user should run "sync" first! |
Kernels 2.6.16 and newer provide a mechanism to have the kernel drop the page cache and/or inode and dentry caches on command, which can help free up a lot of memory. Now you can throw away that script that allocated a ton of memory just to get rid of the cache...
To use /proc/sys/vm/drop_caches, just echo a number to it.
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 are not freeable, the user should run "sync" first!