LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Understanding the output of free memory (https://www.linuxquestions.org/questions/linux-newbie-8/understanding-the-output-of-free-memory-797622/)

sunny8107 03-24-2010 03:44 PM

Understanding the output of free memory
 
All,
I am trying to understand the out of free command. This is on a 4GB Redhat machine. This is what I get:

total used free shared buffers cached
Mem: 3108016 3063752 44264 0 142416 1696244
-/+ buffers/cache: 1225092 1882924
Swap: 2031608 1256 2030352


The output is in kilobytes.
1. Total Mem: is 3.108GB - I guess the remaining (4GB - 3.108GB) is being used by the Kernel and not displayed by the free command?

2. Buffers/Cache: Used: 1.225GB and Free: 1.8829GB
So the total buffers/cache comes out to be 1.225+1.8829 = 3.108GB - which is the same as Total Mem. So I conclude that Buffers/Cache is the Actual RAM Memory available for applications?

3. If I have to answer - what is the free memory available in this machine and why?
a) 44264KB (free Mem)
b) 1882924KB (free -/+ buffers/cache)

Thanks in advance

johnsfine 03-24-2010 03:50 PM

Quote:

Originally Posted by sunny8107 (Post 3910831)
1. Total Mem: is 3.108GB - I guess the remaining (4GB - 3.108GB) is being used by the Kernel and not displayed by the free command?

No, the Kernel is only using a little of that missing memory.

Most of it is unusable, probably because you have a non PAE kernel. You should seriously consider installing the package for a PAE kernel.

Quote:

2. Buffers/Cache: Used: 1.225GB and Free: 1.8829GB
So the total buffers/cache comes out to be 1.225+1.8829 = 3.108GB - which is the same as Total Mem. So I conclude that Buffers/Cache is the Actual RAM Memory available for applications?
No again. That line tells you total memory used and total memory free based on the interpretation that buffers and cache are equivalent to free.

In other words 1.225GB is used by things other than buffer and cache.

sunny8107 03-24-2010 04:01 PM

Quote:

Originally Posted by johnsfine (Post 3910840)
No again. That line tells you total memory used and total memory free based on the interpretation that buffers and cache are equivalent to free.

In other words 1.225GB is used by things other than buffer and cache.

So what does it mean by Free: 1.8829GB
Does that mean the total amount of RAM that is free? Or is the total amount of Free RAM just 44264KB?

johnsfine 03-24-2010 04:28 PM

Quote:

Originally Posted by sunny8107 (Post 3910852)
So what does it mean by Free: 1.8829GB
Does that mean the total amount of RAM that is free? Or is the total amount of Free RAM just 44264KB?

The total buffers+cache+free is 1.8829GB.

For most practical purposes, you should consider memory used by buffers+cache to be free.

If any process needs some memory when there isn't enough free (in the narrower sense of free) the kernel will normally take memory from buffers or cache.

So in the broader sense of "free" (memory that is available for use when needed) buffers+cache is a kind of free memory.

But because there are these two senses of the word "free" for free memory, the free command gives you the information both ways (how much is used and free if you count buffers+cache as used, then how much is used and free if you count buffers+cache as free).

drManhattan 09-21-2010 02:32 PM

It is understandable but sth isn't right for me.

You says that :
Quote:

But because there are these two senses of the word "free" for free memory, the free command gives you the information both ways (how much is used and free if you count buffers+cache as used, then how much is used and free if you count buffers+cache as free).
So if I add buffers + cached it should give me used in the line below ?
142416 + 1696244 = 1838660 (!= 3063752)

Code:

total used free shared buffers cached
Mem: 3108016 3063752 44264 0 142416 1696244

What is the difference between, value of used AND cached+buffers (1225092) ?
3063752 - 1838660 = 1225092



thx for help.


All times are GMT -5. The time now is 09:59 PM.