• 19Apr
    Categories: linux, tips Comments: 0

    Caching inside Linux such as pages and inodes can become quite hugh, and thats the point. Linux wants to utilize all the available memory to create a faster working environment…

    Now, lately I’ve been experimenting on some IR-software (http://lucene.apache.org), and for these experiments I needed to clear the internal page caching of I/O data. Basicly, whenever I open a file, then Linux caches that particular file, so that if I need it again later on, it will be available in “no-time”. For my experiments, I needed a “clean” cache for every run, and therefor needed to clear my cache.

    After some Googling I stumbled upon this site: http://linux-mm.org/Drop_Caches. There was a lot of interessting stuff there, so I would recommend people to read it.

    Basically, whenever you need to uncache something in your computer, you can (in Linux that is), write the following in a terminal:

    This one below will free pagecache:

    # echo 1 > /proc/sys/vm/drop_caches

    This one below will free dentries and inodes:

    # echo 2 > /proc/sys/vm/drop_caches

    This one below will free both pagecache, dentries and inodes:

    # echo 3 > /proc/sys/vm/drop_caches

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.