Free your memory on Linux

Posted by Arkham on December 19th, 2008


No, this is not a howto to make your RAM Stallman-compliant.

Sometimes, it is handy to empty your caches, like when Virtualbox checks the available memory before actually starting. From linux 2.6.16 there are some nice tricks for dropping the memory cache, dentries and inodes.

First of all, we need to free all the cached objects.
Run as root:


Then, 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

Now, check your available memory using free and all your cache are belong to us.. *hu-uhm* ..should have been freed. Freed as in freed-om ;)

This entry was posted on Friday, December 19th, 2008 at 00:06 and is filed under computers. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Tags: ,

One Response to “Free your memory on Linux”

  1. faber Says:

    Free as Free Beer!