我正在分析/proc/pid/smaps
C++ 进程的输出,发现大量私有内存映射区域。内存映射区域的数量根据流量不断增长。
有没有办法可以跟踪代码的哪一部分创建了内存块?我尝试过strace -p <pid>
,但在创建堆栈时无法访问堆栈。
00-7fcea0000000 rw-p 00000000 00:00 0
Size: 65536 kB
Rss: 65520 kB
Pss: 65520 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 65520 kB
Referenced: 65520 kB
Anonymous: 65520 kB
AnonHugePages: 0 kB
Swap: 0 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Locked: 0 kB
VmFlags: rd wr mr mw me nr sd
7fcea4000000-7fcea8000000 rw-p 00000000 00:00 0
Size: 65536 kB
Rss: 65516 kB
Pss: 65516 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 65516 kB
Referenced: 65516 kB
Anonymous: 65516 kB
AnonHugePages: 0 kB
Swap: 0 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Locked: 0 kB
VmFlags: rd wr mr mw me nr sd
7fceac000000-7fceb0000000 rw-p 00000000 00:00 0
Size: 65536 kB
Rss: 65524 kB
Pss: 65524 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 65524 kB
Referenced: 65524 kB
Anonymous: 65524 kB
AnonHugePages: 0 kB
Swap: 0 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Locked: 0 kB
7fceb4000000-7fceb8000000 rw-p 00000000 00:00 0
Size: 65536 kB
Rss: 65528 kB
Pss: 65528 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 65528 kB
Referenced: 65528 kB
Anonymous: 65528 kB
AnonHugePages: 0 kB
Swap: 0 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Locked: 0 kB
VmFlags: rd wr mr mw me nr sd
7fcebc000000-7fcec0000000 rw-p 00000000 00:00 0
Size: 65536 kB
Rss: 65516 kB
Pss: 65516 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 65516 kB
Referenced: 65516 kB
Anonymous: 65516 kB
AnonHugePages: 0 kB
Swap: 0 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Locked: 0 kB
VmFlags: rd wr mr mw me nr sd
7fcec4000000-7fcec8000000 rw-p 00000000 00:00 0
Size: 65536 kB
Rss: 65504 kB
Pss: 65504 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 65504 kB
Referenced: 65504 kB
Anonymous: 65504 kB
AnonHugePages: 0 kB
Swap: 0 kB
332,20 2%