I run the following simple program
#include <stdio.h>
#include <stdlib.h>
int
main() {
malloc(1024*1024*32);
getchar();
return 0;
}
htop
gives this
VIRT RES SHR
36684 312 240
pmap -x
gives this
Address Kbytes RSS Dirty Mode Mapping
0000000000400000 0 4 0 r-x-- a.out
0000000000600000 0 4 4 r---- a.out
0000000000601000 0 4 4 rw--- a.out
00007f063d3b7000 0 4 4 rw--- [ anon ]
00007f063f3b8000 0 228 0 r-x-- libc-2.12.1.so
00007f063f532000 0 0 0 ----- libc-2.12.1.so
00007f063f731000 0 16 16 r---- libc-2.12.1.so
00007f063f735000 0 4 4 rw--- libc-2.12.1.so
00007f063f736000 0 12 12 rw--- [ anon ]
00007f063f73b000 0 108 0 r-x-- ld-2.12.1.so
00007f063f93d000 0 12 12 rw--- [ anon ]
00007f063f958000 0 8 8 rw--- [ anon ]
00007f063f95b000 0 4 4 r---- ld-2.12.1.so
00007f063f95c000 0 4 4 rw--- ld-2.12.1.so
00007f063f95d000 0 4 4 rw--- [ anon ]
00007fff4b298000 0 12 12 rw--- [ stack ]
00007fff4b2d7000 0 4 0 r-x-- [ anon ]
ffffffffff600000 0 0 0 r-x-- [ anon ]
---------------- ------ ------ ------
total kB 36684 432 88
htop
and pmap
show the same virtual size(36684), but they shows different things for physical memory (htop
's RES
= 321 and pmap
's RSS
= 432).
Maybe I confuse something but is there any difference between htop
's RES
and pmap
's RSS
?