Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How Linux uses the Pmap command to see how much memory a process uses

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how Linux uses the Pmap command to check how much memory is used by the process. I believe most people don't know much about it, so share this article for your reference. I hope you will gain a lot after reading this article. Let's learn about it together.

Pmap provides memory mapping for processes, and the pmap command is used to display the memory status of one or more processes. It reports the address space and memory status information of the process. Pmap is actually a command on Sun OS, and linux supports only its limited functionality. But it's still helpful to see the full process address space. We need PID or the process ID of the running process to see the memory status of the process, which we can get through / proc or regular commands such as top or ps.

Grammar or usage

# pmap PID or # pmap [options] PID

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

Option

-x extended display extension format

-d device display device format

-Q quiet does not display header/footer lines

-V displays version information

Single process memory state

[root@info ~] # pmap 1013 1013: / usr/sbin/sshd 00110000 1480K rmurx-/ usr/lib/libcrypto.so.1.0.0 00282000 80K rw-- / usr/lib/libcrypto.so.1.0.0 00296000 12K rw-- [anon] 00299000 36K rmuri x-/ lib/libkrb5support.so.0.1 002a2000 4K rw-- / lib/libkrb5support.so.0.1 002a3000 16K rmurx-/ lib/libplc4.so 002a7000 4K rw-- / lib/libplc4.so 002ab000 88K rmurx-/ lib/libaudit.so.1.0.0 002c1000 4K rmure-/ lib/libaudit.so.1.0.0 002c2000 4K rw-- / lib/libaudit.so.1.0.0 002c3000 216K rmure x-/ lib/libgssapi_krb5.so.2.2 002f9000 4K rw-- / lib/libgssapi_krb5.so.2.2 002fa000 808K rmure x-/ lib/libkrb5.so.3.3 003c4000 24K rw- -/ lib/libkrb5.so.3.3 003ca000 152K rmurx-/ lib/libk5crypto.so.3.1 003f0000 4K rw-- / lib/libk5crypto.so.3.1 003f1000 92K rmurx-/ usr/lib/libnssutil3.so 00738000 4K Raquin-/ lib/libresolv-2.12.so 00739000 4K rw-- / lib/libresolv-2.12.so 0073a000 8K rw-- [anon] 00825000 120K rmurx-/ lib/ld-2.12.so 00843000 4K Rafael-/ lib/ld-2.12.so 00844000 4K rw-- / lib/ld-2.12.so 0090d000 32K Rafe x-/ lib/libwrap.so.0.7.6 00915000 4K rw-- / lib/libwrap.so.0.7.6 00948000 484K Rafe x-/ usr/sbin/sshd 009c1000 8K rw-- / usr/sbin/sshd 009c3000 20K rw-- [anon] 009e0000 92K Rafe x-/ lib/libpthread-2.12.so 009f7000 4K rMurray-/ lib/libpthread-2.12.so total 8232K

Multi-process memory state

We can check multi-process memory by inserting multiple PID. Add multiple PID separated by spaces.

Pmap 1013 1217 1118

Expand process memory

[root@info] # pmap-x 1013 1013: / usr/sbin/sshd Address Kbytes RSS Dirty Mode Mapping 00110000 1480 92 20 r rw-- libplc4.so x-libcrypto.so.1.0.0 00282000 80 80 80 rw-- libcrypto.so.1.0.0 00296000 12 8 4 rw-- [anon] 00299000 36 00 r rw-- libplc4.so x-libkrb5support.so.0.1 002a2000 4 4 4 rw-- libkrb5support.so.0.1 002a3000 16 00 002ab000 88 40 r murx-libaudit.so.1.0.0 002c1000 4 4 4 r muri-libaudit.so.1.0.0 002c2000 4 4 4 rw-- libaudit.so.1.0.0 002c3000 216 40 r muri x-libgssapi_krb5.so.2.2 002f9000 4 4 4 rw-- libgssapi_krb5.so.2.2 002fa000 808 40 r muri x-libkrb5.so.3.3 003c4000 24 24 rw-- libkrb5.so.3.3 003ca000 152 40 r muri x- Libk5crypto.so.3.1 003f0000 4 4 rw-- libk5crypto.so.3.1 003f1000 92 00 r libnssutil3.so 00408000 12 12 12 rw-- libnssutil3.so 0040b000 12 00 r tel x-libplds4.so 0040e000 4 44 rw-- libplds4.so---total kB 8232-

The description of Address,Kbyte,Dirty,RSS,mode and mapping here is as follows

Extension and device format area

Address: memory start address

Kbytes: number of bytes used in memory (KB)

RSS: number of bytes reserved (KB)

Dirty: number of bytes of dirty pages (both shared and private) (KB)

Mode: permissions for memory: read, write, execute, shared, private (copy on write)

Mapping: memory-consuming files, or [anon] (allocated memory), or [stack] (stack)

Offset: file offset

Device: device name (major:minor)

The above is all the contents of the article "how Linux uses the Pmap command to see how much memory the process uses". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report