My processor is using a big part of my RAM memory as cache and I want to clean it up because of that; will it prejudice something?

  • 2
    RAM is a very expensive commodity. Yours isn't being used in its entirety by program data, so the kernel uses the rest for cache and buffers. On a modern operating system, the aim is to have no free memory. When more memory is needed, the kernel will reclaim it automatically. – Alexios Jun 19 '12 at 19:15
  • What is "cleaning up" to you? Wipe the RAM-memory after is is not in use any more? – Nils Jun 19 '12 at 20:43
  • 13
    linuxatemyram.com – Paul Cager Jun 19 '12 at 22:00
  • What is your aim here? What are you trying to achieve by "cleaning up" your RAM? – Burhan Ali Jun 20 '12 at 7:30

There is no need to do this, the kernel manages RAM efficiently by using it for caches and buffers if it is not needed by processes. If processes request more RAM the kernel will deallocate caches and buffers if necessary to satisfy the request.

This ServerFault answer explains how to interpret the memory usage reported by free.


You don't need to do so.

There are two possiblities, if there is something in the cache:

  • it is needed again
  • it is not needed again

In the first case, it is better if it remains in RAM as long as possible, which means: another process needs the RAM. Then it is discarded automatically without your intervention.

In the second case, it doesn't disturb. It's unnecessary work to clean the cache, and can only have negative consequences.

echo 3 > /proc/sys/vm/drop_caches

For details look here.

Another issue is why would you want to do this?

  • -1 because people copy and paste things they see on the internet without understanding them. Without knowing what the actual problem is, this may make things worse. – Burhan Ali Jun 20 '12 at 7:32
  • 2
    Indeed, you should give an explanation instead of just a command to copy/paste. – psusi Jun 20 '12 at 13:41
  • @psusi: Feel free to answer this question with full explanation. – matcheek Jun 20 '12 at 15:02
  • Not OP, but I need to do this to lower the billing plan to a lower-max-mem on a running VPS without rebooting it. – Noel Maersk Mar 26 '18 at 14:23

My processor is using a big part of my RAM memory as cache and I want to clean it up because of that; will it prejudice something?

Yes, much of what is currently in cache will need to fetched from disk. Access from disk used to be 100 of times slower than memory access. Memory speed has increased, much faster than disk speed, so it is likely 10s of thousands of times slower. As a result anything that requires something that is now in cache will be slower the first time you access the flushed data. Whether it it humanly perceptible depends on how much needs to be retrieved.

RAM is a relatively expensive commodity compared to disk, but still quite cheap. Cache is not permanent, and the oldest stuff in cache will be released if needed for something like running a program, or caching something more recently used.

Not the answer you're looking for? Browse other questions tagged or ask your own question.