Linux Pmap command: See how much memory the process is using

Source: Internet
Author: User

PMAP provides a memory map of the process, and the Pmap command is used to display the memory state of one or more processes. It reports the address space and memory status information for the process. Pmap is actually a command on the Sun OS, and Linux only supports its limited functionality. However, it is also useful for viewing the full process address space. We need the PID or the unique process ID of the running process to see the status of the process memory, and we can get it through/proc or regular commands like top or PS.

Syntax or usage

#pmap pid or #pmap [options] pid

It shows all addresses in the output, kbytes,mode and mapping.

Options

    • -X Extended Display Extended format
    • -D Device Display devices format
    • -Q quiet does not display header/footer rows
    • -V Display version information

Single-Process memory state

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

Multi-process Memory state

We can check multi-process memory by inserting multiple PID. Add multiple PID in the middle using a space separator.

pmap 1013 1217 1118

Extending process Memory

  1. [Email protected] ~]# pmap-x 1013
  2. 1013:/usr/sbin/sshd
  3. Address Kbytes RSS Dirty Mode Mapping
  4. 00110000 1480 0 r-x-libcrypto.so.1.0.0
  5. 00282000 rw--libcrypto.so.1.0.0
  6. 00296000 8 4 rw--[anon]
  7. 00299000 0 0 r-x-libkrb5support.so.0.1
  8. 002a2000 4 4 4 rw--libkrb5support.so.0.1
  9. 002a3000 0 0 r-x-libplc4.so
  10. 002a7000 4 4 4 rw--libplc4.so
  11. 002ab000 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 rw--libkrb5.so.3.3
  18. 003ca000 4 0 r-x-libk5crypto.so.3.1
  19. 003f0000 4 4 4 rw--libk5crypto.so.3.1
  20. 003f1000 0 0 r-x-libnssutil3.so
  21. 00408000 rw--libnssutil3.so
  22. 0040b000 0 0 r-x-libplds4.so
  23. 0040e000 4 4 4 rw--libplds4.so
  24. --- --- --- --- ---
  25. Total KB 8232---

The Address,kbyte,dirty,rss,mode and mapping here are as follows

Extension and Device format area

    • Address: Memory Start addresses
    • Kbytes: Number of bytes in memory (KB)
    • RSS: Number of bytes reserved memory (KB)
    • Dirty: Number of bytes in dirty pages (both shared and private) (KB)
    • Mode: Memory Permissions: Read, Write, execute, shared, private (copy on write)
    • Mapping: A file that occupies memory, or [anon] (allocated memory), or [stack] (stack)
    • Offset: File offset
    • Device: Equipment name (Major:minor)

Linux Pmap command: See how much memory the process is using

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.