Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
 
$ pmap -x 10400
10400:   ./a.out
Address           Kbytes     RSS   Dirty Mode   Mapping
0000000000400000       0       0       0 r-x--  a.out
0000000000600000       0       4       4 r----  a.out
0000000000601000       0       4       4 rw---  a.out
00007f957085f000       0       4       0 r-x--  libc-2.15.so
00007f9570a12000       0       0       0 -----  libc-2.15.so
00007f9570c11000       0      16      16 r----  libc-2.15.so
00007f9570c15000       0       8       8 rw---  libc-2.15.so
00007f9570c17000       0       8       8 rw---    [ anon ]
00007f9570c1c000       0       0       0 r-x--  ld-2.15.so
00007f9570e1f000       0      12      12 rw---    [ anon ]
00007f9570e3c000       0       8       8 rw---    [ anon ]
00007f9570e3e000       0       4       4 r----  ld-2.15.so
00007f9570e3f000       0       8       8 rw---  ld-2.15.so
00007fff18a6d000       0      12      12 rw---    [ stack ]
00007fff18bff000       0       4       0 r-x--    [ anon ]
ffffffffff600000       0       0       0 r-x--    [ anon ]
----------------  ------  ------  ------
total kB            4148      92      84
 

RSS is 92

 
$ ps -o rss,sz,vsz 10400
  RSS    SZ    VSZ
   80  1037   4148

RSS is 80

why and what happened ?

share|improve this question
add comment

2 Answers

Basically that may happen because they use different data sources: - /proc/PID/maps is used by pmap - /proc/PID/stat is used by ps

Those sources contain data that is calculated used different methods (reportedly, see here, for example).

share|improve this answer
add comment

From the man page for ps:

   The SIZE and RSS fields don’t count some parts of a process including
   the page tables, kernel stack, struct thread_info, and struct
   task_struct. This is usually at least 20 KiB of memory that is always
   resident. SIZE is the virtual size of the process (code+data+stack).
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.