Linux View Process Address Space

You can view the address space of a process in Linux using the pmap command. pmap is a tool that shows the memory usage of each process and its shared libraries, mapping information and the stack.

Here’s an example of how to use pmap:

# pmap PID

Replace PID with the process ID of the process you want to inspect. The output will show the memory usage of the process, including the size of its address space, the size of its data and bss segments, and the size of its shared libraries.

For example:

# pmap 7427
7427: /usr/bin/python3
0000000008048000 4K r-x-- /usr/bin/python3
0000000008050000 4K r---- /usr/bin/python3
0000000008051000 4K rw--- /usr/bin/python3
000000000805c000 112K rw--- [ anon ]
00007f13b7f18000 132K r-x-- /lib64/ld-2.17.so
00007f13b7f39000 8K r---- /lib64/ld-2.17.so
00007f13b7f3b000 4K rw--- /lib64/ld-2.17.so
00007f13b7f3c000 4K rw--- [ anon ]
...

In this example, pmap is showing the memory usage of process ID 7427, which is a Python script. The output shows the size of the process’ code segment, data segment, shared libraries, and anonymous memory maps.

Leave a Comment