Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
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
11  
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
add comment

4 Answers

up vote 22 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment
sync
echo 3 > /proc/sys/vm/drop_caches

For details look here.

Another issue is why would you want to do this?

share|improve this answer
    
-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
1  
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
add comment

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.

share|improve this answer
add comment

protected by slm May 20 at 19:40

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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