Search This Blog

Tuesday, July 31, 2012

Clear cache memory used by linux kernel and processor cache

You just give one command to do this:
# free && sync && echo 3 > /proc/sys/vm/drop_caches && free
This would clear only disk cache.

In order to clear processor cache memory, there is no perfect method. I can only suggest one method.
At first write a c program to allocate large amount of memory using malloc. That memory should be almost equal to the amount free memory available which you can see using top command. Now fill that allocated memory by writing it with random data or may be even 0. That would clear your processor cached.

No comments: