Clearing the buffers and caches on Linux.

I have been playing around with a couple of modules and monitoring their memory usage.  I wanted to clear the caches and buffers to give me a clearer picture of memory usage.

This command is handy for clearing them out.

sync && echo 3 > /proc/sys/vm/drop_caches

When you run

free -m

after running the above command you will see the buffers and cached values are either zero or very low. and the Total/Used/Free columns are much clearer.

Please do NOT do this on a live production server unless you know what you are doing.

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.