Posted by: Mangesh_Linux_Administrator | November 25, 2010

Clear cache (ram cache)

Linux kernels provide us the provision to clear page cache and/or inode and dentry caches  which can help free to clear a lot of memory.
Following command can help you to check the memory usage.
[root@server~]# free -m
In order to free  pagecache use following command:
[root@server~]# echo 1 > /proc/sys/vm/drop_caches
In order to free dentries and inodes:
[root@server~]# echo 2 > /proc/sys/vm/drop_caches
In order to free pagecache, dentries and inodes:
[root@server]# echo 3 > /proc/sys/vm/drop_caches
As this is a non-destructive operation and dirty objects are not freeable. So run a sync command for this.
[root@server]# sync; echo 3 > /proc/sys/vm/drop_caches


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: