欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

linux pmap

程序员文章站 2022-07-12 19:11:01
...

pmap查看某个进程的内存使用情况

最核心就是最后一句:
mapped:23344Kwriteable/private:1280Kshared:4K

mappedpsvsz
writeable/private使malloc
sharedmmap

[[email protected] ~]# ps -aux | grep nginx
root      1030  0.0  0.0   9028   656 pts/0    R+   11:12   0:00 grep --color=auto nginx
root      1843  0.0  0.0  20832   600 ?        Ss   Jan10   0:00 nginx: master process ./nginx
nobody    1844  0.0  0.1  23344  1600 ?        S    Jan10   0:00 nginx: worker process
[[email protected] ~]# pmap -d 1844
1844:   nginx: worker process
Address           Kbytes Mode  Offset           Device    Mapping
0000000000400000     540 r-x-- 0000000000000000 0fd:00001 nginx
0000000000686000       4 r---- 0000000000086000 0fd:00001 nginx
0000000000687000      64 rw--- 0000000000087000 0fd:00001 nginx
0000000000697000      60 rw--- 0000000000000000 000:00000   [ anon ]
00000000025e4000     264 rw--- 0000000000000000 000:00000   [ anon ]
0000000002626000     216 rw--- 0000000000000000 000:00000   [ anon ]
00007ff42147d000      32 r-x-- 0000000000000000 0fd:00001 libnss_sss.so.2
00007ff421485000    2044 ----- 0000000000008000 0fd:00001 libnss_sss.so.2
00007ff421684000       4 r---- 0000000000007000 0fd:00001 libnss_sss.so.2
00007ff421685000       4 rw--- 0000000000008000 0fd:00001 libnss_sss.so.2
00007ff421686000      48 r-x-- 0000000000000000 0fd:00001 libnss_files-2.17.so
00007ff421692000    2044 ----- 000000000000c000 0fd:00001 libnss_files-2.17.so
00007ff421891000       4 r---- 000000000000b000 0fd:00001 libnss_files-2.17.so
00007ff421892000       4 rw--- 000000000000c000 0fd:00001 libnss_files-2.17.so
00007ff421893000      24 rw--- 0000000000000000 000:00000   [ anon ]
00007ff421899000       8 r-x-- 0000000000000000 0fd:00001 libdl-2.17.so
00007ff42189b000    2048 ----- 0000000000002000 0fd:00001 libdl-2.17.so
00007ff421a9b000       4 r---- 0000000000002000 0fd:00001 libdl-2.17.so
00007ff421a9c000       4 rw--- 0000000000003000 0fd:00001 libdl-2.17.so
00007ff421a9d000     484 r-x-- 0000000000000000 0fd:00001 libfreebl3.so
00007ff421b16000    2048 ----- 0000000000079000 0fd:00001 libfreebl3.so
00007ff421d16000       4 r---- 0000000000079000 0fd:00001 libfreebl3.so
00007ff421d17000       4 rw--- 000000000007a000 0fd:00001 libfreebl3.so
00007ff421d18000      16 rw--- 0000000000000000 000:00000   [ anon ]
00007ff421d1c000    1756 r-x-- 0000000000000000 0fd:00001 libc-2.17.so
00007ff421ed3000    2044 ----- 00000000001b7000 0fd:00001 libc-2.17.so
00007ff4220d2000      16 r---- 00000000001b6000 0fd:00001 libc-2.17.so
00007ff4220d6000       8 rw--- 00000000001ba000 0fd:00001 libc-2.17.so
00007ff4220d8000      20 rw--- 0000000000000000 000:00000   [ anon ]
00007ff4220dd000      84 r-x-- 0000000000000000 0fd:00001 libz.so.1.2.7
00007ff4220f2000    2044 ----- 0000000000015000 0fd:00001 libz.so.1.2.7
00007ff4222f1000       4 r---- 0000000000014000 0fd:00001 libz.so.1.2.7
00007ff4222f2000       4 rw--- 0000000000015000 0fd:00001 libz.so.1.2.7
00007ff4222f3000     384 r-x-- 0000000000000000 0fd:00001 libpcre.so.1.2.0
00007ff422353000    2044 ----- 0000000000060000 0fd:00001 libpcre.so.1.2.0
00007ff422552000       4 r---- 000000000005f000 0fd:00001 libpcre.so.1.2.0
00007ff422553000       4 rw--- 0000000000060000 0fd:00001 libpcre.so.1.2.0
00007ff422554000      32 r-x-- 0000000000000000 0fd:00001 libcrypt-2.17.so
00007ff42255c000    2044 ----- 0000000000008000 0fd:00001 libcrypt-2.17.so
00007ff42275b000       4 r---- 0000000000007000 0fd:00001 libcrypt-2.17.so
00007ff42275c000       4 rw--- 0000000000008000 0fd:00001 libcrypt-2.17.so
00007ff42275d000     184 rw--- 0000000000000000 000:00000   [ anon ]
00007ff42278b000      92 r-x-- 0000000000000000 0fd:00001 libpthread-2.17.so
00007ff4227a2000    2044 ----- 0000000000017000 0fd:00001 libpthread-2.17.so
00007ff4229a1000       4 r---- 0000000000016000 0fd:00001 libpthread-2.17.so
00007ff4229a2000       4 rw--- 0000000000017000 0fd:00001 libpthread-2.17.so
00007ff4229a3000      16 rw--- 0000000000000000 000:00000   [ anon ]
00007ff4229a7000     128 r-x-- 0000000000000000 0fd:00001 ld-2.17.so
00007ff422b84000     212 rw--- 0000000000000000 000:00000   [ anon ]
00007ff422bb9000      20 rw--- 0000000000000000 000:00000   [ anon ]
00007ff422bc5000       4 rw-s- 0000000000000000 000:00004 zero (deleted)
00007ff422bc6000       4 rw--- 0000000000000000 000:00000   [ anon ]
00007ff422bc7000       4 r---- 0000000000020000 0fd:00001 ld-2.17.so
00007ff422bc8000       4 rw--- 0000000000021000 0fd:00001 ld-2.17.so
00007ff422bc9000       4 rw--- 0000000000000000 000:00000   [ anon ]
00007fffb3218000     132 rw--- 0000000000000000 000:00000   [ stack ]
00007fffb3375000       8 r-x-- 0000000000000000 000:00000   [ anon ]
ffffffffff600000       4 r-x-- 0000000000000000 000:00000   [ anon ]
mapped: 23344K    writeable/private: 1280K    shared: 4K