That doesn't explain my simple test on Solaris 2.6 sun4u: "sleep 1000
&" has 704 kbytes rss from ps -o rss, but 824 kbytes of Resident and
744 Shared from pmap -x. 824-744=80 kbytes, way off from 704 kbytes.
If you look at the source code (free download), ps(1) uses
/proc/[pid]/psinfo while pmap(1) uses /proc/[pid]/xmap. I think
/proc/[pid]/psinfo is known to be a good source (/usr/ucb/ps uses this
structure too; David Curry's Systems Programming book also uses it if
I remember right). As to /proc/[pid]/xmap, I've found other problems.
For instance, when the process has a shared memory segment such as an
Oracle process, there could be a non-zero number under Private for the
shmid=?? segment in pmap -x output (Permissions shows shared
correctly). The Private number is either 0 or much smaller if intimate
shared memory is not used.
Yong Huang
> In pmap, it is counted also from a shared segments, that is the part of
> the memory, which is also reused by other pid's.
> I think :)