memory

Posted on

Hi,
I like to find the accurate memory a process holds.

more /proc/1018/smaps|grep -i pss
Pss: 16 kB
Pss: 4 kB
Pss: 4 kB
Pss: 40 kB
Pss: 0 kB
Pss: 0 kB
Pss: 0 kB
Pss: 4 kB
Pss: 4 kB
Pss: 4 kB
Pss: 0 kB
Pss: 0 kB
Pss: 4 kB
Pss: 4 kB
Pss: 14 kB
Pss: 0 kB
Pss: 16 kB
Pss: 8 kB
Pss: 12 kB
Pss: 14 kB
Pss: 0 kB
Pss: 4 kB
Pss: 4 kB
Pss: 4 kB
Pss: 0 kB
Pss: 16 kB
Pss: 4 kB
Pss: 4 kB
Pss: 4 kB
Pss: 4 kB
Pss: 16 kB
Pss: 0 kB
Pss: 0 kB
The sum is 208kb.

pmap 1018
1018: /usr/bin/rhsmcertd
00005596ad89e000 16K r-x-- rhsmcertd
00005596adaa1000 4K r---- rhsmcertd
00005596adaa2000 4K rw--- rhsmcertd
00005596af557000 132K rw--- [ anon ]
00007f7528833000 103692K r---- locale-archive
00007f752ed76000 92K r-x-- libpthread-2.17.so
00007f752ed8d000 2044K ----- libpthread-2.17.so
00007f752ef8c000 4K r---- libpthread-2.17.so
00007f752ef8d000 4K rw--- libpthread-2.17.so
00007f752ef8e000 16K rw--- [ anon ]
00007f752ef92000 384K r-x-- libpcre.so.1.2.0
00007f752eff2000 2048K ----- libpcre.so.1.2.0
00007f752f1f2000 4K r---- libpcre.so.1.2.0
00007f752f1f3000 4K rw--- libpcre.so.1.2.0
00007f752f1f4000 1808K r-x-- libc-2.17.so
00007f752f3b8000 2044K ----- libc-2.17.so
00007f752f5b7000 16K r---- libc-2.17.so
00007f752f5bb000 8K rw--- libc-2.17.so
00007f752f5bd000 20K rw--- [ anon ]
00007f752f5c2000 1104K r-x-- libglib-2.0.so.0.5600.1
00007f752f6d6000 2044K ----- libglib-2.0.so.0.5600.1
00007f752f8d5000 4K r---- libglib-2.0.so.0.5600.1
00007f752f8d6000 4K rw--- libglib-2.0.so.0.5600.1
00007f752f8d7000 4K rw--- [ anon ]
00007f752f8d8000 136K r-x-- ld-2.17.so
00007f752faeb000 16K rw--- [ anon ]
00007f752faf8000 4K rw--- [ anon ]
00007f752faf9000 4K r---- ld-2.17.so
00007f752fafa000 4K rw--- ld-2.17.so
00007f752fafb000 4K rw--- [ anon ]
00007ffd0ab8c000 132K rw--- [ stack ]
00007ffd0abeb000 8K r-x-- [ anon ]
ffffffffff600000 4K r-x-- [ anon ]
total 115816K
But library from above can be shared with other process so the above 115816K is not accurate.right?

with gdb can i find more accurate figure if compare
with /proc/pid/smaps?how can i do it?
other way?