golang pprof 内存问题定位

在主函数中引入包 _ "net/http/pprof" //debug

在main方法里加入

//debug
go func() {
_ = http.ListenAndServe("0.0.0.0:6060", nil)
}()
go tool pprof -alloc_space -cum -svg http://127.0.0.1:6060/debug/pprof/heap

> heap.svg

即可弄到内存数据分析图片 用浏览器打开即可

 

posted @ 2019-11-15 11:08  浮生逍遥  阅读(714)  评论(0编辑  收藏  举报