理论上,用 perf probe 可以实现一个非侵入式的内存分析器,不过 go 已经内置了,所以没啥用处。
perf probe -x /home/data/server/parca/parca --vars runtime.mallocgc Available variables at runtime.mallocgc @<runtime.mallocgc+0> bool needzero runtime._type* typ uintptr dataSize uintptr size
perf probe -x /home/data/server/parca/parca --line malloc.go
perf probe 无法使用 dwarf 中的数据,也就是使用 filename:funcname 的方式去定位数据。
perf probe -x /home/data/server/parca/parca runtime.mallocgc data
这篇文章会写的更为详细一些。