FindPage
View Source:
dropcache
Note:
You are viewing an old version of this page.
View the current version.
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: <verbatim> # echo 1 > /proc/sys/vm/drop_caches </verbatim> To free dentries and inodes: <verbatim> # echo 2 > /proc/sys/vm/drop_caches </verbatim> To free pagecache, dentries and inodes: <verbatim> echo 3 > /proc/sys/vm/drop_caches </verbatim> As this is a non-destructive operation and dirty objects are not freeable, the user should run "sync" first! bin/dropcache: <verbatim> #!/bin/sh exec sudo /bin/sh -c 'sync; sync; sync; sync; echo 3 > /proc/sys/vm/drop_caches' </verbatim>