Many users tend to worry when the free memory on a Linux system is very low. Especially when the system is barely active. What many don’t know is that this is normal behavior for Linux. It simply takes your free memory and caches it. This caching behavior makes subsequent memory allocations much faster. So it improves performance overall.
However, if you really really need to flush the cache and buffers, you can run the following two commands on the shell as root:
sync; echo 3 > /proc/sys/vm/drop_caches
Here’s the output of free before and after running the above command.
# free -m total used free shared buffers cached Mem: 502 487 15 0 15 170 -/+ buffers/cache: 301 201 Swap: 3153 375 2777
# free -m total used free shared buffers cached Mem: 502 345 157 0 1 44 -/+ buffers/cache: 300 202
As you can see the highlighted numbers, the buffers and cached values have dropped significantly after I ran the command. Again, this is not necessary. In fact, it’s not recommended at all but there it is if you’re curious to know.
That’s all folks. I hope you enjoyed this one.