We have a go
process in production using Gigabytes more memory than usual. It's suffered from an unusual memory leak. We stopped input to this process to allow the GC to settle. It is still running with a RES of multiple Gigabytes. Is there a way to attach to this process and dump heap in a way that can be analyzed using hprof visualization tools?
Asked
Active
Viewed 1,447 times
1

trincot
- 317,000
- 35
- 244
- 286

OregonTrail
- 8,594
- 7
- 43
- 58
-
related https://stackoverflow.com/questions/19080755/golang-how-to-use-pprof-heap-profile-to-find-memory-leaks / https://www.freecodecamp.org/news/how-i-investigated-memory-leaks-in-go-using-pprof-on-a-large-codebase-4bec4325e192/#:~:text=WriteHeapDump – Sep 19 '21 at 20:35
-
https://github.com/golang/go/issues/45631 / https://github.com/golang/go/wiki/heapdump15-through-heapdump17 – Sep 19 '21 at 20:42
1 Answers
0
for now, you can use runtime package to write heap profile to a file, and analyze it with gpreftools visualization tool.

Jiang YD
- 3,205
- 1
- 14
- 20