[NTLUG:Discuss] True memory usage

gan hawk ganhawk at gmail.com
Thu Oct 27 17:27:08 CDT 2005


HI,

>From what I understand:

RSS total is different because you are counting the shared pages
multiple times. RSS is per process and there will be physical pages
mapped to multiple processes.

Also, Free command also uses /proc/meminfo.
The total Free memory reported by the kernel is a good indicator.
Although the inactive memory is also included in the used memory. The
active memory is the physical memory that is being used by the user
processes.


ganesh

> $ 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
>
>
> _______________________________________________
> https://ntlug.org/mailman/listinfo/discuss
>




More information about the Discuss mailing list