How to analyze golang memory?

前端 未结 4 1090
滥情空心
滥情空心 2020-12-04 05:28

I wrote a golang program, that uses 1.2GB of memory at runtime.

Calling go tool pprof http://10.10.58.118:8601/debug/pprof/heap results in a dump with o

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 06:04

    As an addition to @Cookie of Nine's answer, in short: you can try the --alloc_space option.

    go tool pprof use --inuse_space by default. It samples memory usage so the result is subset of real one.
    By --alloc_space pprof returns all alloced memory since program started.

提交回复
热议问题