0

I'm trying to investigate a memory leak in our service. And for some reason, while HeapAlloc grows up to 3.7gb, pprof heap profiler explains only 2.4gb. What is that 1.3gb space for?

I thought, that HeapAlloc memory is exactly what heap profiler should describe.

  • Hi Svetlana. Can you elaborate a bit on your service? How do you run it, on what platform, does it spawn child processes, use coroutines etc. – Andre Wildberg Jan 23 '23 at 23:26
  • As I know, go usually pre-reserve memory for scaling later. Even with hello world program, It may pre-reserve 1GB of memory. – Minh Jan 24 '23 at 02:01
  • @AndreWildberg it's a usual web server, it runs in Kubernetes pod. It does use goroutines (I've also monitored goroutines count, and there are no goroutines leak), no, it does not spawn child processes. – Svetlana Jan 24 '23 at 07:37
  • @Minh, Yep, but as I understand, MemStats.HeapAlloc monitors the amount of memory, allocated for objects, and it does not include free slab slots, as HeapInuse does. – Svetlana Jan 24 '23 at 07:45
  • @Svetlana In that case, I can only think about sample rate of pprof. May be at the time pprof get sample, the memory was freed? You should try to increase the sample rate of pprof. – Minh Jan 25 '23 at 14:50

0 Answers0