英文:
Go(lang): How to use PPROF heap profile to find memory leaks?
问题
我正在尝试使用pprof来验证内存泄漏。
有人能解释一下如何阅读在http://localhost:6060/debug/pprof/heap?debug=1
找到的堆剖析文件吗?
另外,启动go tool pprof http://localhost:6060/debug/pprof/heap
后,输入web
命令产生一个空的.svg文件,这正常吗?
非常感谢!
英文:
I am trying to use pprof to verify memory leaks.
Can any explain how to read the heap profile that you find at:
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?
Many Thanks
答案1
得分: 4
我可以帮你解答第二个问题。你需要在命令中提供二进制文件的名称:
go tool pprof YOUR_COMPILED_BINARY http://localhost:6060/debug/pprof/heap
英文:
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
答案2
得分: 1
在这篇英特尔的博客文章中很好地解释了如何阅读堆剖析结果:链接。
> 每个条目开头的数字("1: 262144 [4: 376832]")分别表示当前存活对象的数量、存活对象占用的内存量、总分配次数和所有分配占用的内存量。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论