pprof is Go’s profiling toolset for collecting and analyzing runtime profiles. For memory investigations, it exposes a heap profile through an HTTP endpoint, allowing analysis of a running service. section 7.2.4
Use pprof to identify memory that grows unexpectedly:
- Capture a heap profile after startup with go tool pprof http://localhost:6060/debug/pprof/heap. section 7.2.4
- Run representative traffic through the service, then capture a second profile. section 7.2.4
- Use pprof’s diff mode to determine which allocations grew between snapshots. section 7.2.4
- Compare the result with expected lifetime: request data should disappear, while caches and configuration objects should remain bounded. section 7.2.4


