[英]Go(lang): How to use PPROF heap profile to find memory leaks?
I am trying to use pprof to verify memory leaks.我正在尝试使用 pprof 来验证内存泄漏。
Can any explain how to read the heap profile that you find at: http://localhost:6060/debug/pprof/heap?debug=1
任何人都可以解释如何阅读您在以下位置找到的堆配置文件:
http://localhost:6060/debug/pprof/heap?debug=1
Also, is it normal that by typing the web
command after starting go tool pprof http://localhost:6060/debug/pprof/heap
it produces an empty .svg file?另外,在启动
go tool pprof http://localhost:6060/debug/pprof/heap
后输入web
命令会产生一个空的 .svg 文件是否正常?
Many Thanks非常感谢
I may help with the second question.我可以帮忙回答第二个问题。 You must provide the name of the binary to your command:
您必须为您的命令提供二进制文件的名称:
go tool pprof YOUR_COMPILED_BINARY http://localhost:6060/debug/pprof/heap
How to read the heap-profile is explained pretty good in this intel blogpost : 这篇英特尔博文中很好地解释了如何阅读堆配置文件:
The numbers in the beginning of each entry ("1: 262144 [4: 376832]") represent number of currently live objects, amount of memory occupied by live objects, total number of allocations and amount of memory occupied by all allocations, respectively.
每个条目开头的数字(“1:262144 [4:376832]”)分别表示当前活动对象的数量、活动对象占用的内存量、分配总数和所有分配占用的内存量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.