Clear the memory cache in Linux

By | February 20, 2009

In Linux, you can clear the cache of the memory by using

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

10 thoughts on “Clear the memory cache in Linux

  1. Pingback: Clear memory cache to speed up your box « Linux & Stuff

  2. failzo

    How to do that with Ubuntu? I tried it with sudo, but it keeps saying Permission is needed.

    faizlo

    Reply
  3. Tarentrulle

    or try sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"

    Reply
  4. GCXX

    just want to thanks to Tarentrulle
    sudo sh -c “sync; echo 3 > /proc/sys/vm/drop_caches”
    saved my life!

    Reply
  5. vga over cat5

    I have test and working successfully on debian6. But I wonder if its a good habit to use on a daily cron on my vps has limited memory on it.

    My vps has 512mb memory so I wonder does this function help to use my memory efficiently.

    What do you think about it ?

    Reply
  6. Lars R.

    @vga over cat5: It is completely useless to flush the block cache on Linux.

    The Kernel wipes unecessary entries as soon as it needs memory for other purposes. Until them the chaces are kept. Unused RAM is just useless.

    Reply
  7. Nnitesh

    Thanks a tonn sir, sync; echo 3 > /proc/sys/vm/drop_caches

    This command helped me a lot.
    Cleared cached memory from 2GB to 500mb.. Excellent.

    Thanks

    Reply
  8. xibjulous

    ok this made no sense at all for me what do i type it into a word document or what??

    Reply

Leave a Reply to GCXX Cancel reply

Your email address will not be published. Required fields are marked *