[NTLUG:Discuss] True memory usage

Robert Thompson ntlug at thorshammer.org
Wed Oct 19 20:35:34 CDT 2005


Hello,

	I am trying to figure out the best way to get the 'true' memory usage
for a machine. When I do a free I think I'm supposed to look at the
'used' section under the -/+ buffers/cache line:

$ free
             total       used       free     shared    buffers
cached
Mem:        904832     895972       8860          0      18060
565936
-/+ buffers/cache:     311976     592856
Swap:       755044        164     754880

	So the above means I am using 311M of memory?

	When I attempt to add up the memory from doing a ps aux and adding the
RSS (resident set size) I get something different (larger than total
memory):

$ FOO=0; for i in `ps aux | egrep -v "RSS|grep" | awk '{print $6}'`; do
FOO=`expr $FOO + $i`; done; echo $FOO
1394520
$

	The above shows that RSS added up equals 1.3G.

	If I cat /proc/meminfo I get different numbers:

$ cat /proc/meminfo
MemTotal:       904832 kB
MemFree:          9420 kB
Buffers:         21956 kB
Cached:         555012 kB
SwapCached:          0 kB
Active:         423472 kB
Inactive:       427616 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:       904832 kB
LowFree:          9420 kB
SwapTotal:      755044 kB
SwapFree:       754880 kB
Dirty:              20 kB
Writeback:           0 kB
Mapped:         329116 kB
Slab:            34056 kB
CommitLimit:   1207460 kB
Committed_AS:   511640 kB
PageTables:       1660 kB
VmallocTotal:   122840 kB
VmallocUsed:     29204 kB
VmallocChunk:    91604 kB
$

	Which of them is the 'used' memory? The only ones close to 311M are
'Active' (it's off by 100M) and 'Mapped'. Even if I run one command
after the other on the command line ($ free; cat /proc/meminfo) I still
get numbers that are off.

	So what is the 'true' used memory on the machine and why do the
different commands give different numbers if they are supposed to be
looking at the same thing?

Robert Thompson





More information about the Discuss mailing list