4
 
$ 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 ?

3

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).
  • Even though this is not directly related to this question, is the RSS generally in IEC units (KiB)? – white_gecko Oct 23 '16 at 15:05
3

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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