Go(lang): How to use PPROF heap profile to find memory leaks?

Daniele B picture Daniele B · Sep 29, 2013 · Viewed 7.8k times · Source

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

Answer

alpe1 picture alpe1 · Oct 29, 2013

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