Linux CentOS strange memory readings

Posted by user2008937 on Server Fault See other posts from Server Fault or by user2008937
Published on 2014-05-31T01:27:33Z Indexed on 2014/05/31 3:29 UTC
Read the original article Hit count: 194

Filed under:
|
|
|

I am actually a young junior sys admin.

I have a question - i am trying to understand how linux deals with memory... while playing around different monitoring programs I found some strange thing.

When I run top on my laptop it shows me that FIREFOX process with pid 8778 takes 18,3% of memory (%MEM column).

grep "MemTotal" /proc/meminfo

Above command give me 1848336kb/1024 = 1805megs of memory (its ok - i have 2 gigs of ram). So if the firefox process takes 18,3% of MEM(according to tops %MEM column) then it takes 0.183 * 1805 which is approximately 325mb of memory. Quite a lot as for firefox... But well, in Linux there are lots of shared libraries that programs commonly uses (like famous libc). And those libraries are added to memory utilization of every process that uses it in the system, despite they are actually reading same file(single object in memory). So top may show too big mem utilization because of those shared libraries. Well, it is time to use PMAP which should show us the real mem utilization of process. But..

pmap -d $(pidof firefox) mapped: 983460K writeable/private: 757164K shared: 66416K

so pmap shows that 983460/1024=993MB of memory is mapped to this process. It is in fact much bigger than mem utilization showed by top.

Whats wrong here? How pmap can show more than top? even when top adds also the shared libraries (which in fact are single objects in memory) for each process that uses it? and pmap omits it?

Regards Krzysztof

© Server Fault or respective owner

Related posts about linux

Related posts about centos