Take the 2-minute tour ×

This question already has an answer here:

The system is not overloaded and there is no huge process that eats memory (RAM) but still it has only 20-40 MB free.

Who is taking RAM and should I avoid it? (how?)

share|improve this question
add comment

marked as duplicate by Chris S Feb 21 at 15:55


6 Answers

See: http://www.linuxatemyram.com

See also: http://virtualthreads.blogspot.com/2006/02/understanding-memory-usage-on-linux.html

share|improve this answer
+1: Excellent links - thanks! –  Jon Cage May 28 '09 at 13:38
I'd never seen linuxatemyram.com, great link! –  ceejayoz May 28 '09 at 13:55
+1: Good link, don't knew it... –  sebthebert Jun 1 '09 at 15:37
+1 Fantastic link. I've started using pmap now that I have a better understanding of how to cross ref it to ps aux. –  Patrick R Feb 16 '10 at 18:39
add comment

Linux considers free RAM a waste of resources. Any memory not being used to store a program is used as buffer space to cache recent disk activity etc. It will flush the buffers to disk to make space as required for program memory allocation needs.

share|improve this answer
add comment

The 'free' command will show you buffers and cache. The line that starts with -/+ buffers/cache shows the amount of really used and free memory with the buffers and cache subtracted.

             total       used       free     shared    buffers     cached
Mem:           373        350         23          0        135        109
-/+ buffers/cache:        105        268
Swap:          511          0        511

Notice that:

  • this machine has 373MB of RAM, of which 350MB is use, leaving 23MB memory free
  • that 350MB includes 135MB of buffers and 109MB of cache
  • when we subtract those buffers and cache amounts, only 105MB is actually used, leaving 268MB of memory free

The moment it is needed, cache is dropped and buffers are flushed to free memory. This provides very little overhead when the memory the moment the memory needs to be freed and provides significant performance increase as long as the memory can be used as buffers / cache.

So, if you want to know the total amount of free (as in: usable by programs) memory, look at the amount in the 'free'-column in the '-/+ buffers/cache' row.

share|improve this answer
add comment

A similar question to this was asked in ServerFault recently


disclaimer: I am currently the highest rated answer on that question

share|improve this answer
add comment

Install htop to actually have that visualized.


Note that memory occupied by applications or really occupied is marked green. Blue and orange are buffers and cache.

share|improve this answer
add comment

Operating systems tend not to let good RAM go to waste. Whether it is Linux or Windows or Mac OS X, you can be pretty sure all your memory that is visible to the OS has been put to good use. The OS will use everything as cache unless that memory is specifically required for something else. The way the different memory reporting utilities display a "Memory Used" single number or graph is a design decision that estimates what type of memory usage the user is most likely to want to know.

share|improve this answer
add comment

protected by MadHatter Feb 21 at 15:48
