| Updated: October 28, 2024 |
Learn how to calculate virtual memory reserved by a process using the pmap file. A brief description of the parameters found in the file is given along with an example of how to read the output.
The value of the as_stats.anon.rsv parameter represents the virtual memory reserved by the process with the process ID pid. See the vmsat page to learn more about the file output.
cat /proc/<pid>/pmap
Below is a quick description of each parameter:
cat /proc/self/pmap
# cat /proc/self/pmap
vaddr,size,flags,prot,maxprot,dev,ino,offset,rsv,guardsize,refcnt,mapcnt,path
0x0000001c0ae92000,0x0000000000002000,0x00010071,0x05,0x0d,0x00000802,0x00000000c00000ab,\z
0x0000000000000000,0x0000000000000000,0x00000000,0x0000017e,0x0000017c,/bin/cat
0x0000001c0ae94000,0x000000000000f000,0x000800a2,0x00,0x0f,0x00000001,0x0000000000000003,\z
0x0000000000002000,0x0000000000000000,0x00000000,0x00000000,0x000001de,{bss}
0x0000001c0aea3000,0x0000000000001000,0x00010032,0x01,0x0f,0x00000802,0x00000000c00000ab,\z
0x0000000000001000,0x0000000000001000,0x00000000,0x0000017e,0x0000017c,/bin/cat
0x0000001c0aea4000,0x0000000000001000,0x00010032,0x03,0x0f,0x00000802,0x00000000c00000ab,\z
0x0000000000002000,0x0000000000001000,0x00000000,0x0000017e,0x0000017c,/bin/cat
0x0000001c0aea5000,0x0000000000008000,0x00080032,0x03,0x0f,0x00000001,0x0000000000000003,\z
0x0000000000000000,0x0000000000008000,0x00000000,0x00000000,0x000001de,{bss}
0x0000002f26c08000,0x0000000000037000,0x00010071,0x05,0x0d,0x00000802,0x00000000c000000a,\z
0x0000000000000000,0x0000000000000000,0x00000000,0x0000017e,0x0000017c,/usr/lib/ldqnx-64.so.2
0x0000002f26c3f000,0x000000000000f000,0x000800a2,0x00,0x0f,0x00000001,0x0000000000000003,\z
0x0000000000037000,0x0000000000000000,0x00000000,0x00000000,0x000001de,{bss}
0x0000002f26c4e000,0x0000000000002000,0x00010072,0x01,0x0f,0x00000802,0x00000000c000000a,\z
0x0000000000036000,0x0000000000002000,0x00000000,0x0000017e,0x0000017c,/usr/lib/ldqnx-64.so.2
0x0000002f26c50000,0x0000000000001000,0x00010072,0x03,0x0f,0x00000802,0x00000000c000000a,\z
0x0000000000038000,0x0000000000001000,0x00000000,0x0000017e,0x0000017c,/usr/lib/ldqnx-64.so.2
0x0000002f26c51000,0x0000000000001000,0x00080032,0x03,0x0f,0x00000001,0x0000000000000003,\z
0x0000000000000000,0x0000000000001000,0x00000000,0x00000000,0x000001de,{bss}
0x0000002f26c52000,0x00000000000b0000,0x00010071,0x05,0x0d,0x00000802,0x00000000c000000c,\z
0x0000000000000000,0x0000000000000000,0x00000000,0x0000017e,0x0000017c,/proc/boot/libc.so.5
0x0000002f26d02000,0x0000000000010000,0x00080022,0x00,0x0f,0x00000001,0x0000000000000003,\z
0x00000000000b0000,0x0000000000000000,0x00000000,0x00000000,0x000001de,{bss}
0x0000002f26d12000,0x0000000000004000,0x00080032,0x01,0x0f,0x00000001,0x0000000000000003,\z
0x0000000000000000,0x0000000000004000,0x00000000,0x00000000,0x000001de,{bss}
0x0000002f26d16000,0x0000000000002000,0x00010072,0x03,0x0f,0x00000802,0x00000000c000000c,\z
0x00000000000b4000,0x0000000000002000,0x00000000,0x0000017e,0x0000017c,/proc/boot/libc.so.5
0x0000002f26d18000,0x0000000000002000,0x00080032,0x03,0x0f,0x00000001,0x0000000000000003,\z
0x0000000000000000,0x0000000000002000,0x00000000,0x00000000,0x000001de,{bss}
0x0000002f26d1a000,0x0000000000013000,0x00010071,0x05,0x0d,0x00000802,0x00000000c000000e,\z
0x0000000000000000,0x0000000000000000,0x00000000,0x0000017e,0x0000017c,/proc/boot/libgcc_s.so.1
0x0000002f26d2d000,0x000000000000f000,0x00080022,0x00,0x0f,0x00000001,0x0000000000000003,\z
0x0000000000013000,0x0000000000000000,0x00000000,0x00000000,0x000001de,{bss}
0x0000002f26d3c000,0x0000000000001000,0x00080032,0x01,0x0f,0x00000001,0x0000000000000003,\z
0x0000000000000000,0x0000000000001000,0x00000000,0x00000000,0x000001de,{bss}
0x0000002f26d3d000,0x0000000000001000,0x00010072,0x03,0x0f,0x00000802,0x00000000c000000e,\z
0x0000000000013000,0x0000000000001000,0x00000000,0x0000017e,0x0000017c,/proc/boot/libgcc_s.so.1
0x00000035f9b83000,0x0000000000080000,0x00081082,0x03,0x0f,0x00000001,0x0000000000000003,\z
0x0000000000000000,0x0000000000002000,0x00001000,0x00000000,0x000001de,{stack}
0x0000004af7d62000,0x000000000000b000,0x00080002,0x03,0x0f,0x00000001,0x0000000000000003,\z
0x0000000000000000,0x000000000000b000,0x00000000,0x00000000,0x000001de,{heap}
This region is of type code. It is a shared read-only mapping of an object and has reserved 0KB of virtual memory.
This region is of type data (read only) and has reserved its maximum of 4KB of memory.
| Region type | Row numbers | Reserved memory in KB | Total in KB |
|---|---|---|---|
| Code | 1, 6, 11, 16 | 0, 0, 0, 0 | 0 |
| Data (Read Only) | 3, 8, 13, 18 | 4, 8, 16, 4 | 32 |
| Data (Read/Write) | 4, 5, 9, 10, 15, 14, 19 | 4, 32, 4, 4, 8, 8, 4 | 64 |
| Other | 2, 7, 12, 17 | 0, 0, 0, 0 | 0 |
| Heap | 21 | 44 | 44 |
| Stack | 20 | 8 | 8 |
| Total virtual memory reserved by cat: | 148 | ||
# cat /proc/self/vmstat as_stats.vm_region=22 as_stats.vm_map=15 as_stats.map_size=0x1a2 (1.632MB) as_stats.map_phys=0xff (1020.000kB) as_stats.map_shared=0xff (1020.000kB) as_stats.map_private=0xa3 (652.000kB) as_stats.rss=0x1e (120.000kB) as_stats.flt_read=0 as_stats.flt_write=3 as_stats.flt_exec=0 as_stats.flt_zero=0 as_stats.flt_zfod=24 as_stats.flt_cow=13 as_stats.flt_hit=0 as_stats.flt_miss=0 as_stats.anon_rsv=0x25 (148.000kB) as_stats.rlimit_data=0xb (44.000kB)