Linux Pmap command: view the memory used by the Process

Source: Internet
Author: User

Pmap provides memory ing for processes. The pmap command is used to display the memory status of one or more processes. It reports the address space and memory status of the process. Pmap is actually a command on Sun OS. linux only supports its limited functions. However, it is helpful for viewing the complete process address space. We need the PID or the unique process ID of the running process to view the process memory status. We can get it through/proc or conventional commands such as top or ps.

Syntax or usage

# Pmap PID or # pmap [options] PID

In the output, all addresses, kbytes, mode, and mapping are displayed.

Option

  • -X extended display extension format
  • -D device: Display device format
  • -Q quiet does not display the header/footer line
  • -V: display version information

Memory status of a single process

 
 
  1. [root@info ~]# pmap 1013 
  2.  
  3.  
  4. 1013: /usr/sbin/sshd 
  5. 00110000 1480K r-x- /usr/lib/libcrypto.so.1.0.0 
  6. 00282000 80K rw-- /usr/lib/libcrypto.so.1.0.0 
  7. 00296000 12K rw-- [ anon ] 
  8. 00299000 36K r-x- /lib/libkrb5support.so.0.1 
  9. 002a2000 4K rw-- /lib/libkrb5support.so.0.1 
  10. 002a3000 16K r-x- /lib/libplc4.so 
  11. 002a7000 4K rw-- /lib/libplc4.so 
  12. 002ab000 88K r-x- /lib/libaudit.so.1.0.0 
  13. 002c1000 4K r-- /lib/libaudit.so.1.0.0 
  14. 002c2000 4K rw-- /lib/libaudit.so.1.0.0 
  15. 002c3000 216K r-x- /lib/libgssapi_krb5.so.2.2 
  16. 002f9000 4K rw-- /lib/libgssapi_krb5.so.2.2 
  17. 002fa000 808K r-x- /lib/libkrb5.so.3.3 
  18. 003c4000 24K rw-- /lib/libkrb5.so.3.3 
  19. 003ca000 152K r-x- /lib/libk5crypto.so.3.1 
  20. 003f0000 4K rw-- /lib/libk5crypto.so.3.1 
  21. 003f1000 92K r-x- /usr/lib/libnssutil3.so 
  22. 00738000 4K r--- /lib/libresolv-2.12.so 
  23. 00739000 4K rw-- /lib/libresolv-2.12.so 
  24. 0073a000 8K rw-- [ anon ] 
  25. 00825000 120K r-x- /lib/ld-2.12.so 
  26. 00843000 4K r--- /lib/ld-2.12.so 
  27. 00844000 4K rw-- /lib/ld-2.12.so 
  28. 0090d000 32K r-x- /lib/libwrap.so.0.7.6 
  29. 00915000 4K rw-- /lib/libwrap.so.0.7.6 
  30. 00948000 484K r-x- /usr/sbin/sshd 
  31. 009c1000 8K rw-- /usr/sbin/sshd 
  32. 009c3000 20K rw-- [ anon ] 
  33. 009e0000 92K r-x- /lib/libpthread-2.12.so 
  34. 009f7000 4K r--- /lib/libpthread-2.12.so 
  35.  
  36. total 8232K 

Multi-process memory status

We can check the multi-process memory by inserting multiple PIDs. Separate multiple PIDs with spaces.

Pmap 1013 1217 1118

Extended process memory

 
 
  1. [root@info ~]# pmap -x 1013 
  2. 1013: /usr/sbin/sshd 
  3. Address Kbytes RSS Dirty Mode Mapping 
  4. 00110000 1480 92 0 r-x- libcrypto.so.1.0.0 
  5. 00282000 80 80 80 rw-- libcrypto.so.1.0.0 
  6. 00296000 12 8 4 rw-- [ anon ] 
  7. 00299000 36 0 0 r-x- libkrb5support.so.0.1 
  8. 002a2000 4 4 4 rw-- libkrb5support.so.0.1 
  9. 002a3000 16 0 0 r-x- libplc4.so 
  10. 002a7000 4 4 4 rw-- libplc4.so 
  11. 002ab000 88 4 0 r-x- libaudit.so.1.0.0 
  12. 002c1000 4 4 4 r--- libaudit.so.1.0.0 
  13. 002c2000 4 4 4 rw-- libaudit.so.1.0.0 
  14. 002c3000 216 4 0 r-x- libgssapi_krb5.so.2.2 
  15. 002f9000 4 4 4 rw-- libgssapi_krb5.so.2.2 
  16. 002fa000 808 4 0 r-x- libkrb5.so.3.3 
  17. 003c4000 24 24 24 rw-- libkrb5.so.3.3 
  18. 003ca000 152 4 0 r-x- libk5crypto.so.3.1 
  19. 003f0000 4 4 4 rw-- libk5crypto.so.3.1 
  20. 003f1000 92 0 0 r-x- libnssutil3.so 
  21. 00408000 12 12 12 rw-- libnssutil3.so 
  22. 0040b000 12 0 0 r-x- libplds4.so 
  23. 0040e000 4 4 4 rw-- libplds4.so 
  24.  
  25. --- --- --- --- --- 
  26. total kB 8232 - - - 

Here the Address, Kbyte, Dirty, RSS, mode and mapping are described as follows:

Extended and device format regions

  • Address: memory start Address
  • Kbytes: the number of bytes in memory)
  • RSS: the number of bytes in the memory retained in KB)
  • Dirty: the number of Dirty pages in bytes, including shared and private) KB)
  • Mode: Memory permission: read, write, execute, shared, private (copy upon writing)
  • Mapping: memory-occupied files, or [anon] allocated memory), or [stack] stack)
  • Offset: file Offset
  • Device: Device Name (major: minor)

Via: http://linoxide.com/linux-command/pmap-command/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.