[root@s3 twitter]# go tool pprof http://localhost:6060/debug/pprof/heap --text
Read http://localhost:6060/debug/pprof/symbol
Fetching /pprof/heap profile from localhost:6060 to
/tmp/76z7mNTrzO
Wrote profile to /tmp/76z7mNTrzO
AdjusTing heap profiles for 1-in-524288 sampling rate
@R_110_10586@l: 47.5 MB
24.5 51.6% 51.6% 24.5 51.6% reflect.unsafe_NewArray
23.0 48.4% 100.0% 23.0 48.4% database/sql.convertAssign
0.0 0.0% 100.0% 23.0 48.4% database/sql.(*Rows).Scan
0.0 0.0% 100.0% 47.5 100.0% github.com/coopernurse/gorp.(*DbMap).SELEct
0.0 0.0% 100.0% 47.5 100.0% github.com/coopernurse/gorp.hookedSELEct
0.0 0.0% 100.0% 47.5 100.0% github.com/coopernurse/gorp.rawSELEct
0.0 0.0% 100.0% 47.5 100.0% main.getTwitterNoParse
0.0 0.0% 100.0% 27.5 57.9% main.main
0.0 0.0% 100.0% 47.5 100.0% main.parseHtml
0.0 0.0% 100.0% 24.5 51.6% reflect.Append
0.0 0.0% 100.0% 24.5 51.6% reflect.MakeSlice
0.0 0.0% 100.0% 24.5 51.6% reflect.grow
0.0 0.0% 100.0% 1.4 2.9% runtime.MProf_Malloc
0.0 0.0% 100.0% 1.4 2.9% runtime.callers
0.0 0.0% 100.0% 25.1 52.8% runtime.gosched0

0.0 0.0% 100.0% 26.8 56.4% runtime.main


[root@s3 twitter]# go tool pprof http://localhost:6060/debug/pprof/heap --text
Read http://localhost:6060/debug/pprof/symbol
Fetching /pprof/heap profile from localhost:6060 to
/tmp/6rfif3xDyB
Wrote profile to /tmp/6rfif3xDyB
AdjusTing heap profiles for 1-in-524288 sampling rate
@R_110_10586@l: 57.1 MB
30.1 52.7% 52.7% 30.1 52.7% reflect.unsafe_NewArray
27.0 47.3% 100.0% 27.0 47.3% database/sql.convertAssign
0.0 0.0% 100.0% 27.0 47.3% database/sql.(*Rows).Scan
0.0 0.0% 100.0% 57.1 100.0% github.com/coopernurse/gorp.(*DbMap).SELEct
0.0 0.0% 100.0% 57.1 100.0% github.com/coopernurse/gorp.hookedSELEct
0.0 0.0% 100.0% 57.1 100.0% github.com/coopernurse/gorp.rawSELEct
0.0 0.0% 100.0% 57.1 100.0% main.getTwitterNoParse
0.0 0.0% 100.0% 27.5 48.2% main.main
0.0 0.0% 100.0% 57.1 100.0% main.parseHtml
0.0 0.0% 100.0% 30.1 52.7% reflect.Append
0.0 0.0% 100.0% 30.1 52.7% reflect.MakeSlice
0.0 0.0% 100.0% 30.1 52.7% reflect.grow
0.0 0.0% 100.0% 1.4 2.5% runtime.MProf_Malloc
0.0 0.0% 100.0% 1.4 2.5% runtime.callers
0.0 0.0% 100.0% 25.1 44.0% runtime.gosched0
0.0 0.0% 100.0% 26.8 46.9% runtime.main


内存占用在增加!

(pprof) top
@R_110_10586@l: 94.1 MB
49.6 52.7% 52.7% 49.6 52.7% reflect.unsafe_NewArray
44.5 47.3% 100.0% 44.5 47.3% database/sql.convertAssign
0.0 0.0% 100.0% 44.5 47.3% database/sql.(*Rows).Scan

生成svg,得安装graphviz , 浏览器打开svg,图很清楚。

yum install graphviz -y

大佬总结

以上是大佬教程为你收集整理的[Golang]如何检查内存泄漏(1)全部内容,希望文章能够帮你解决[Golang]如何检查内存泄漏(1)所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。