Showing posts from March, 2011

free command: Releasing the disk cache

Linux uses its free memory for caching stuff which helps reduce IO . For many, this looks like memory is running low but everything is fine actually. This cached memory can be released if needed by tuning some kernel parameters. But probably nobody would like to do this except for bench marking purpose. Disk cache actually makes applications load faster and run smoother

Tuning /proc/sys/vm/drop_caches

The following is the state of  memory utilization in my desktop.

$ free -m
                    total        used       free      shared    buffers     cached
Mem:          1987       1805        181          0         230          1298
-/+ buffers/cache:        276       1710
Swap:         1906           0         1906

We can see from the first row,  "free" is reporting only 181M to be free and around 1298M has been used for disk cache.

Now let's tune  /proc/sys/vm/drop_caches to release the memory used for cache. We can specify 3 values to drop_caches. Default value is 0 which …