I am using list command in go tool pprof to analyse heap profile. On using the list command I am expecting to see lines in source that allocates specified amount of memory. This is how my result looks like.
(pprof) list getItems
Total: 259.09MB ROUTINE ======================== ddb.(*ItemDL).getEvents in /bld/src/my-repo/ddb/item_process_dl.go
0 322.15MB (flat, cum) 124.34% of Total . . 201: ExpressionAttributeValues: expr.Values(), . . 202: //Limit: aws.Int64(1000), . . 203: } . . 204: if nil != lastEvaluatedKey { . . 205: params.SetExclusiveStartKey(lastEvaluatedKey) . 163.08MB 206: }
//some more souce code
. . 266: LaunchTS: qItem.LaunchTS + svcparam.TimeToBumpUp, . 21.01MB 267: }
Why are the values pointing to lines having no source code and just }. How to interpret the above results ?
}
In the pprof output you provided, the lines like } with memory allocations are part of the function epilogue or prologue and may not be directly related to specific lines of your source code. The memory allocated there is often associated with bookkeeping or other tasks performed by the Go runtime during the function execution.
pprof
Here’s how to interpret the output:
Total
322.15MB
ROUTINE ========================
ddb.(*ItemDL).getEvents
/bld/src/my-repo/ddb/item_process_dl.go
322.15MB (flat, cum) 124.34% of Total
163.08MB 206:
206
163.08MB
.
if
flat
cum
When interpreting memory profiles, it’s essential to focus on the areas of your code that contribute significantly to memory consumption. In some cases, memory allocations may occur in parts of the function not directly related to specific lines of your source code, such as function prologues and epilogues, which are generated by the Go runtime.