Author Topic: How to clear the Linux Memory Cache  (Read 620 times)

arjun.datasoft

  • Blue Belt
  • ****
  • Posts: 180
  • Karma: +0/-0
How to clear the Linux Memory Cache
« on: August 21, 2013, 04:33:38 PM »
Hi,

Here are the steps

The user should run "sync" first in order to make sure all cached objects are freed.
[root@server ~]# sync
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

Done.Then  you can check the memory
[root@server ~]# free -m


Thanks
« Last Edit: August 23, 2013, 05:12:55 PM by arjun.datasoft »