Linux Process Memory Analysis PMAP command

Source: Internet
Author: User

Transferred from: http://blog.csdn.net/u013982161/article/details/52654256

Name:

Pmap-report memory Map of a process (view information about the image of the processes)

Usage

Pmap [-X |-d] [-Q] PIDs ...

Pmap-v

Option meaning

-X Extended Show the extended format. Show extended format

-D device Show the Deviceformat. Display device format

-Q quiet do not display some header/footerlines. Do not display kinsoku lines

-V Show version displays version of program. Show version

Extended format and Device format fields:

Address:start address Ofmap image start addresses

Kbytes:size of map in kilobytes image size

Rss:resident set size Inkilobytes resident set sizes

Dirty:dirty pages (both Sharedand private) in kilobytes dirty page size

Mode:permissions on map image permissions: R=read,w=write, X=execute, s=shared, p=private (copy on Write)

Mapping:file backing the map, or ' [anon] ' for allocated memory, or ' [stack] ' for the program stack. Image support file, [anon] is a program stack for allocated memory [stack]

Offset:offset into the file offset

Device:device name (major:minor) device name

Example:

To view the device format for process 1

[Email protected] ~]# pmap-d 1

1:init [5]

Address Kbytes Mode Offset Device Mapping

00934000 r-x--0000000000000000 008:00005ld-2.3.4.so

0094a000 4 R----0000000000015000 008:00005ld-2.3.4.so

0094b000 4 rw---0000000000016000 008:00005ld-2.3.4.so

0094e000 1188 r-x--0000000000000000 008:00005 libc-2.3.4.so

00a77000 8 R----0000000000129000 008:00005libc-2.3.4.so

00a79000 8 rw---000000000012b000 008:00005libc-2.3.4.so

00a7b000 8 rw---0000000000a7b000 000:00000 [anon]

00a85000 r-x--0000000000000000 008:00005libsepol.so.1

00a92000 4 rw---000000000000c000 008:00005libsepol.so.1

00a93000-RW---0000000000a93000 000:00000 [anon]

00d9d000 r-x--0000000000000000 008:00005libselinux.so.1

00daa000 4 rw---000000000000d000 008:00005libselinux.so.1

08048000 r-x--0000000000000000 008:00005 Init

0804f000 4 rw---0000000000007000 008:00005 init

084e1000 RW---00000000084e1000 000:00000 [anon]

b7f5d000 8 rw---00000000b7f5d000 000:00000 [anon]

bffee000 RW---00000000bffee000 000:00000 [stack]

ffffe000 4-----0000000000000000 000:00000 [anon]

mapped:1700k writeable/private:276k shared:0k

[Email protected] ~]#

The value of the last row

Mapped represents the size of the virtual address space for the process map, which is the amount of virtual memory that the process has pre-allocated, which is the PS-out vsz

Writeable/private represents the size of the private address space that the process consumes, that is, the amount of memory that the process actually uses

Shared represents the amount of memory shared by the process and other processes

View the device format for process 1 without showing the Kinsoku line

[[email protected] ~]# pmap-d-Q 1

1:init [5]

00934000 r-x--0000000000000000 008:00005ld-2.3.4.so

0094a000 4 R----0000000000015000 008:00005ld-2.3.4.so

0094b000 4 rw---0000000000016000 008:00005ld-2.3.4.so

0094e000 1188 r-x--0000000000000000 008:00005 libc-2.3.4.so

00a77000 8 R----0000000000129000 008:00005libc-2.3.4.so

00a79000 8 rw---000000000012b000 008:00005libc-2.3.4.so

00a7b000 8 rw---0000000000a7b000 000:00000 [anon]

00a85000 r-x--0000000000000000 008:00005libsepol.so.1

00a92000 4 rw---000000000000c000 008:00005libsepol.so.1

00a93000-RW---0000000000a93000 000:00000 [anon]

00d9d000 r-x--0000000000000000 008:00005libselinux.so.1

00daa000 4 rw---000000000000d000 008:00005libselinux.so.1

08048000 r-x--0000000000000000 008:00005 Init

0804f000 4 rw---0000000000007000008:00005 init

084e1000 RW---00000000084e1000 000:00000 [anon]

b7f5d000 8 rw---00000000b7f5d000 000:00000 [anon]

bffee000 RW---00000000bffee000 000:00000 [stack]

ffffe000 4-----0000000000000000 000:00000 [anon]

[Email protected] ~]#

View the extended format for process 1

[Email protected] ~]# Pmap-x 1

1:init [5]

Address Kbytes RSS Anon Locked Mode Mapping

00934000---r-x--ld-2.3.4.so

0094a000 4---R----ld-2.3.4.so

0094b000 4---RW---ld-2.3.4.so

0094e000 1188---r-x--libc-2.3.4.so

00a77000 8---R----libc-2.3.4.so

00a79000 8---RW---libc-2.3.4.so

00a7b000 8---RW---[anon]

00a85000---r-x--libsepol.so.1

00a92000 4---RW---libsepol.so.1

00a93000--RW---[anon]

00d9d000---r-x--libselinux.so.1

00daa000 4---RW---libselinux.so.1

08048000---r-x--Init

0804f000 4---RW---Init

084e1000---RW---[anon]

b7f5d000 8---RW---[anon]

bffee000--RW---[Stack]

ffffe000 4--------[anon]

-------- ------- ------- ------- -------

Total KB 1700---

[Email protected] ~]#

Loop shows the last 1 lines of the device format for process 3066, in intervals of 2 seconds,

[[email protected] ~]# while true; Do pmap-d 3066 | TAIL-1; Sleep 2; Done

mapped:5412k writeable/private:2028k shared:0k

mapped:5412k writeable/private:2028k shared:0k

mapped:5412k writeable/private:2028k shared:0k

mapped:5412k writeable/private:2028k shared:0k

mapped:5412k writeable/private:2028k shared:0k

mapped:5412k writeable/private:2028k shared:0k

mapped:5412k writeable/private:2028k shared:0k

mapped:5412k writeable/private:2028k shared:0k

mapped:5412k writeable/private:2028k shared:0k

mapped:5412k writeable/private:2028k shared:0k

mapped:5412k writeable/private:2028k shared:0k

mapped:5412k writeable/private:2028k shared:0k

mapped:5412k writeable/private:2028k shared:0k

Linux Process Memory Analysis 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.