Writing to on of this three files will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
To free pagecache:
1 | echo 1 > /proc/sys/vm/drop_caches |
To free dentries and inodes:
1 | echo 2 > /proc/sys/vm/drop_caches |
To free pagecache, dentries and inodes:
1 | sync && echo 3 > /proc/sys/vm/drop_caches |
As this is a non-destructive operation, and dirty objects are not freeable, you should run every time “sync” before you start to drop something.
1 | sync && echo 3 > /proc/sys/vm/drop_caches |
Swappiness
Control swappiness behavior:
1 | cat /proc/sys/vm/swappiness |
1 | echo 100 > /proc/sys/vm/swappiness |
Leave a Reply