0

I'm having trouble interpreting the output of a pmap command. I want to see how many memory segments are added to the process when one of the libraries (libupper/librot13) implementing a transform is loaded. I run this command:

(echo "hello world" ; sleep 100) | ./cat++ -l ./librot13.so & pmap -x $!

My output is something like this:

9962:   ./cat++ -l ./librot13.so
Address           Kbytes     RSS   Dirty Mode  Mapping
000055c081659000       8       8       0 r-x-- cat++
000055c081659000       0       0       0 r-x-- cat++
000055c08185a000       4       4       4 r---- cat++
000055c08185a000       0       0       0 r---- cat++
000055c08185b000       4       4       4 rw--- cat++
000055c08185b000       0       0       0 rw--- cat++
000055c0836d8000     132      16      16 rw---   [ anon ]
000055c0836d8000       0       0       0 rw---   [ anon ]
00007f14d9d2e000       4       4       0 r-x-- librot13.so
.................
total kB            8648    1440     112

Now, what part of this is telling me the number of memory segments? Also, what's happening because of calling the same library (librot13) twice?

  • There are 5 unique memory addresses, the r-x or the text or code segment of the cat++, the r-- or the r/o data of the cat++ and the rw- or r/w data of the cat++, the rw- anon which is probably the heap, and the r-x or code segment of the librot13.so. If you put a 'sleep 1' before the pmap some more segments might appear. – icarus Nov 3 '19 at 22:07
  • I'm not sure if I'm following. This is only a part of the output. Are you suggesting that the number of unique logical address = number of memory segments? – Jbd Nov 3 '19 at 22:09
  • 1
    If you tell me exactly what you mean by memory segment then I would probably agree that unique logical address = number of memory segments. – icarus Nov 3 '19 at 22:11
  • You say the output is "something like" the above; is this actually the output from an instance of running this command? In general, each address is the beginning of a sequence of virtual memory addresses Kbytes in length. – Andy Dalton Nov 4 '19 at 1:15
  • Yes, this is an actual output but I have only copied a part of it since it was quite long. – Jbd Nov 4 '19 at 10:49

Your Answer

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

Browse other questions tagged or ask your own question.