understanding go pprof output

48 views Asked by At

I have an networking application in go, which I am trying to do memory profiling. I periodically generate pprof files by calling pprof.WriteHeapProfile(f), which generates a file mem1.pprof. Then I do:

go tool pprof -traces mem1.pprof > trace.out

part of the trace.out looks like this:

     bytes:  10.89MB
   10.89MB   gin.mobius.com/mobi/storage.(*wireExecution).EnterBatchLimit
             gin.mobius.com/mobi/storage.(*State).EnterBatchLimit
             gin.mobius.com/mobi.(*Policy).EnterBatchNetReceiver
             gin.mobius.com/mobi.(*Policy).netReceive
             gin.mobius.com/mobi.(*Policy).RunningStep
             gin.mobius.com/mobi.(*Policy).Execute
             gin.mobius.com/mobi.(*Policy).StartRun.func1
-----------+-------------------------------------------------------
     bytes:  5.45MB
    5.45MB   gin.mobius.com/mobi/storage.(*wireExecution).EnterBatchLimit
             gin.mobius.com/mobi/storage.(*State).EnterBatchLimit
             gin.mobius.com/mobi.(*Policy).EnterBatchNetReceiver
             gin.mobius.com/mobi.(*Policy).netReceive
             gin.mobius.com/mobi.(*Policy).RunningStep
             gin.mobius.com/mobi.(*Policy).Execute
             gin.mobius.com/mobi.(*Policy).StartRun.func1
-----------+-------------------------------------------------------
     bytes:  704B
  512.34kB   gin.mobius.com/mobi/storage.(*wireExecution).EnterBatchLimit
             gin.mobius.com/mobi/storage.(*State).EnterBatchLimit
             gin.mobius.com/mobi.(*Policy).EnterBatchNetReceiver
             gin.mobius.com/mobi.(*Policy).netReceive
             gin.mobius.com/mobi.(*Policy).RunningStep
             gin.mobius.com/mobi.(*Policy).Execute
             gin.mobius.com/mobi.(*Policy).StartRun.func1

Please help me understand this output. I know there is only one goroutine with that callstack running.

  1. Then what do these repeated call stacks with different values for memory mean?
  2. When pprof.WriteHeapProfile() gets called if it is getting snapshot of heap memory being used at that time, how come there are multiple call stacks getting shown?
0

There are 0 answers