7

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

Daniele B
  • 19,801
  • 29
  • 115
  • 173

2 Answers2

3

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
alpe1
  • 350
  • 1
  • 9
1

How to read the heap-profile is explained pretty good in this intel blogpost:

The numbers in the beginning of each entry ("1: 262144 [4: 376832]") represent number of currently live objects, amount of memory occupied by live objects, total number of allocations and amount of memory occupied by all allocations, respectively.

Sjon
  • 4,989
  • 6
  • 28
  • 46
  • 1
    The Intel website seems to not bother itself with [cool URIs](https://www.w3.org/Provider/Style/URI.html), so here's an [archive link](https://web.archive.org/web/20140703183759/https://software.intel.com/en-us/blogs/2014/05/10/debugging-performance-issues-in-go-programs). – Ainar-G Dec 13 '21 at 11:02