procutils-pmap 0.2.0

Report memory map of a process
Documentation

pmap

Report memory map of a process.

Description

Displays the memory map of one or more processes, showing the address ranges, sizes, permissions, and mapped files or regions for each mapping.

Inputs

  • /proc/[pid]/maps -- memory mappings (address range, permissions, offset, device, inode, pathname)
  • /proc/[pid]/smaps -- extended per-mapping memory info including RSS, Private_Dirty, and Shared_Dirty (used with -x)
  • /proc/[pid]/cmdline -- command line (displayed in the header)

Arguments

Argument Description
pid... (required, positional) One or more process IDs to display

Format selection

These flags are mutually exclusive. If none is specified, the default format is used.

Flag Description
-x, --extended Show extended format with RSS and Dirty columns (reads smaps)
-d, --device Show device format with Offset and Device columns

Display options

Flag Description
-q, --quiet Suppress header and footer lines
-p, --show-path Show full file paths instead of basenames

Behavior

For each requested PID, pmap prints a header line (unless -q), followed by one line per memory mapping, and a footer with totals (unless -q).

Header

PID:   command_name

Default mode

Columns: Address, Kbytes, Mode, Mapping.

Address           Kbytes Mode  Mapping
000055a4c8200000     152 r-x-- bash
000055a4c8425000       4 r---- bash
...
 total            123456K

The footer shows the total virtual size in kB.

Extended mode (-x)

Columns: Address, Kbytes, RSS, Dirty, Mode, Mapping.

Reads /proc/[pid]/smaps to obtain RSS and dirty page counts for each mapping. The footer shows totals for Kbytes, RSS, and Dirty.

Address           Kbytes     RSS   Dirty Mode  Mapping
000055a4c8200000     152     148       0 r-x-- bash
...
----------------  ------  ------  ------
total             123456   45678    1234K

Device mode (-d)

Columns: Address, Kbytes, Mode, Offset, Device, Mapping.

The Offset is the file offset of the mapping. The Device is the major:minor device number. The footer shows the mapped total, writeable/private total, and shared total.

Address           Kbytes Mode  Offset           Device    Mapping
000055a4c8200000     152 r-x-- 0000000000000000 008:00001 bash
...
mapped: 123456K    writeable/private: 2345K    shared: 6789K

Permission string format

Permissions are displayed as a 5-character string: rwxs- where:

  • r = readable (or -)
  • w = writable (or -)
  • x = executable (or -)
  • s = shared, - = private
  • Trailing -

Examples: r-x-- (read-execute, private), rw-s- (read-write, shared).

Mapping names

  • File-backed mappings show the file basename, or the full path with -p.
  • Anonymous mappings show [ anon ].
  • Stack regions show [ stack ].
  • Special kernel regions show [ vdso ], [ vvar ], [ vsyscall ], etc.

Exit codes

Code Meaning
0 All requested PIDs were displayed successfully
42 One or more requested PIDs could not be found

Divergences from procps-ng

Behaviour matches procps-ng for the supported flag set — default, device (-d), and extended (-x) formats; their quiet (-q) variants; and the multi-PID layout. Some procps-ng features are not yet implemented:

  • -X / -XX — "extra extended" formats that expose arbitrary smaps fields as columns. Plain -x covers the common Kbytes/RSS/Dirty case.
  • -c / -C / -n / -N — config-file selection. pmap does not consult a config file.

The default format prints a column-header row above the mappings (Address Kbytes Mode Mapping), which procps-ng omits in the non-extended modes. This is cosmetic; the data rows are unchanged.

Error messages for invalid arguments use different wording.