Not completely… usually the applications use some amount of shared memory too 
(e.g. shared libraries which are loaded into memory only once for a number of 
apps).

 

________________________________

From: [email protected] [mailto:[email protected]] On 
Behalf Of raid fifa
Sent: Monday, September 20, 2010 12:32 PM
To: Red Hat Enterprise Linux 5 (Tikanga) discussion mailing-list
Subject: Re: [rhelv5-list] mismatch between top and free -m

 

sorry for my puzzled email.
I mean "used memory" of free should be around equal to SUM of the values of RES 
column from top cmd. Is that right? or my mis-understand?

*^_^*

--- 10年9月20日,周一, John Haxby <[email protected]> 写道:


发件人: John Haxby <[email protected]>
主题: Re: [rhelv5-list] mismatch between top and free -m
收件人: "Red Hat Enterprise Linux 5 (Tikanga) discussion mailing-list" 
<[email protected]>
日期: 2010年9月20日,周一,下午5:26

 

On 20 September 2010 08:35, raid fifa <[email protected]> wrote:

!179 $ free -m
             total       used       free     shared    buffers     cached
Mem:         15925      15837         88          0         76       7408
-/+ buffers/cache:       8352       7573
Swap:         8189          0       8189

top - 03:34:23 up 29 days,  6:15,  5 users,  load average: 3.92, 3.72, 2.70
Tasks: 172 total,   1 running, 171 sleeping,   0 stopped,   0 zombie
Cpu(s): 23.2%us,  3.1%sy,  0.0%ni, 63.4%id,  9.7%wa,  0.0%hi,  0.6%si,  0.0%st
Mem:  16307832k total, 16222676k used,    85156k free,    78732k buffers
Swap:  8385920k total,      148k used,  8385772k free,  8372932k cached


Which numbers do you think are inconsistent?   There's a minor discrepancy 
between the "free -m" free and the top free (85156/1024 == 83 vs 88) but those 
5MB could just be down to timing.

Both free and top get their statistics from /proc/meminfo so any 
inconsistencies you think you're seeing are simply in the way that the utility 
chooses to represent the information.  As Morgan Langley says, though, the "+-/ 
buffers/cached" line in the output of free is sometimes confusing, but it just 
subtracts or adds 76+7408 from the "used" and "free" values respectively 
(there's a bit of a rounding error in there though).  The premise here is that 
"buffers" and "cached" can be quickly freed if needed -- that's only true up to 
a point.

If you want to know exactly what values from /proc/meminfo are being used and 
how then you'll have to dig into the source code of free and top.  After that 
you're down to getting the developers to justify their choices; and they may 
not know!

jch 


-----下面为附件内容-----

_______________________________________________
rhelv5-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/rhelv5-list


 

_______________________________________________
rhelv5-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/rhelv5-list

Reply via email to