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

sandeep2444

  • Blue Belt
  • ****
  • Posts: 154
  • Karma: +0/-0
How to clear the Linux Memory Cache
« on: February 29, 2016, 01:45:01 AM »
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