Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
Meaning of the buffers/cache line in the output of free
Why is Linux reporting “free” memory strangely?

I have a 12GB RAM VPS where I host a a couple of static websites , 2 small Magento powered stores and a couple of WordPress installations - overall nothing exciting and generally low traffic.

I've noticed though that my memory consumption is quite high - kindly have a look at the results of free m below:

             total       used       free     shared    buffers     cached
Mem:      12306384   12137728     168656          0     753360    8629744
-/+ buffers/cache:    2754624    9551760
Swap:      1048564        104    1048460

Also see a screenshot out of Mumin

Now I reckon that 9,5 GB seem to be buffer / cache related - however I find this quite high. Is this something I have to worry about or will they eventually free themselves ? (I've read it somewhere but I am certainly not an expert)

Another note on the side is that Memcached has been installed once and applied to one of my Magento installation - could it be related to it?

Some expert advise would be truly appreciated.

share|improve this question

marked as duplicate by Michael Hampton, EEAA, mdpc, faker, dunxd Jan 4 '13 at 11:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
As in the duplicate pointed out above, the link to linuxatemyram.com might be helpful. –  dunxd Jan 4 '13 at 11:13

1 Answer 1

You walk into a factory and all the employees are working. "Why aren't employees sitting on a couch doing nothing?", you wonder. Well, duh, that's kind of dumb. The employees should be working, not sitting around waiting for work.

If you're thinking "I want the RAM to be free now so I can use it later", well that's dumb too. You don't need the RAM to be free now to use it later. You can use it now and use it later and get the best of both worlds.

It's not like if you use only 8GB today you can use 20GB tomorrow. Not using memory right now provides no advantage whatsoever, just opportunity lost forever. There is no cost associated with using memory that the system has and so no reason not to use as much of it as you possibly can.

Say the system did make more memory free. One of two things would happen:

  1. That memory wouldn't be used later. In which case, the effort of making it free would be completely wasted.

  2. That memory would be used later. In which case, the effort of making it free would be wasted, since it would just have to make it used again.

Modern operating systems only make memory free when they have absolutely no choice. It takes effort to do so, and that effort just has to be undone when the memory is used again. Instead, the memory is directly transitioned from one use to another without ever being free. Free memory is only needed for special use cases where memory cannot be transitioned from one use to another, such as in an interrupt context. Only a very small amount of free memory is needed for that purpose, typically 64MB or less.

share|improve this answer
    
linuxatemyram.com is more entertaining. :) –  Michael Hampton Jan 4 '13 at 5:23
    
@MichaelHampton: I find that site encourages the mistaken belief that "free memory is good" rather than pointing out how wrongheaded it is. Free memory is bad -- it represents waste and cost. You should want as little of it as possible. –  David Schwartz Jan 4 '13 at 5:23
    
Strange, your reading of that site is quite different than mine. –  Michael Hampton Jan 4 '13 at 5:24
    
For example, it says, But what do you call memory that is both used for something and available for applications? You would call that "free", but Linux calls it "used". Why would I call that free? It is in fact used. Rather than correcting this as a misunderstanding, it's suggesting that understanding is correct. For example, later under "How do I see how much free RAM I really have", it suggests that the idea that 99% of the RAM is free is correct when it's not. –  David Schwartz Jan 4 '13 at 5:27
    
You would call that "free" if you were a new user who didn't understand that Linux is actually doing something with that "free" memory. You wouldn't call it "free" if you actually knew what was going on, which is the whole point of the site. –  Michael Hampton Jan 4 '13 at 5:28

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