
通过 linux top 查看到程序占用了 1.8G 内存,但使用 go tool pprof 查看到的只有几 M
go tool pprof http://localhost:6060/debug/pprof/heap (pprof) top Showing nodes accounting for 1.78MB, 100% of 1.78MB total flat flat% sum% cum cum% 1.78MB 100% 100% 1.78MB 100% github.com/mozillazg/go-pinyin.init /root/local/go/src/github.com/mozillazg/go-pinyin/pinyin_dict.go 0 0% 100% 1.78MB 100% _/root/projections/rpc/gox.init <autogenerated> 0 0% 100% 1.78MB 100% main.init <autogenerated> 0 0% 100% 1.78MB 100% runtime.main /root/go/src/runtime/proc.go (pprof) 1 htfy96 2018 年 2 月 6 日 Go 的 virt 占用大是正常的,res 比较接近实际 |
3 Morriaty OP |
4 cloudzhou 2018 年 2 月 6 日 问题是什么呢 |
5 Morriaty OP @cloudzhou 问题比较具体,不太好说 如果碰到相似情况,可以参考 google forum 那篇,是具体解释 pprof/heap 里的字段含义 还有这篇,具体讲 profile 过程 https://github.com/bradfitz/talk-yapc-asia-2015/blob/master/talk.md |