25 September 2011

How to remove memory caches in Linux

[root@our12-db1 ~]# free -m -t
             total       used       free     shared    buffers     cached
Mem:         48288      46384       1904          0        315      38199
-/+ buffers/cache:       7870      40418
Swap:        32767        105      32662
Total:       81056      46490      34566
[root@our12-db1 ~]# sudo sync && sudo sysctl -w vm.drop_caches=3 && sudo sysctl -w vm.drop_caches=o
vm.drop_caches = 3
vm.drop_caches = o
[root@our12-db1 ~]# free -m -t
             total       used       free     shared    buffers     cached
Mem:         48288      11533      36755          0          2       4228
-/+ buffers/cache:       7302      40986
Swap:        32767        105      32662
Total:       81056      11638      69418
[root@our12-db1 ~]#

No comments: