Interpretting the pprof memory profile

246 views
Skip to first unread message

Patrik Iselind

unread,
Jan 22, 2019, 2:21:07 PM1/22/19
to golang-nuts
Hi,

I'm looking at memory profiles and have a hard time interpreting what I see. I'm trying to better understand what I am looking at in `go tools pprof` why looking at the raw data. All 'groups' at the end of output from /debug/pprof/heap have lines that begin with "0: 0 [0: 0] @0x.......". It's these zeros I cannot wrap my head around.

As I read the source code for pprof, I interpret the zeros as; there are zero inuse object and there has never been any allocations for the following call stack. This seem like a really strange interpretation, why save a call stack from which there has never been made any allocations? How am I supposed to interpret it?

That line format follows the format of "n: m [N: M] @0x...." where, as I interpret the source code, we have
n = number of objects that are in use and allocated using the call stack just below
m = how many bytes these n objects occupy
N = number of object ever allocated using the call stack just below
M = how many bytes these m objects occupy

n and m has to do with what is called the inuse_object and inuse_space respectively.
N and M has to do with what is called the alloc_object and alloc_space respectively.

It might just be my interpretation of inuse and alloc. I see inuse as something that still has a reference to it while alloc show the total count of objects allocated at a certain call stack. Given this interpretation, I cannot see how zeros make sense.

Please help me understand.

// Patrik

Ian Lance Taylor

unread,
Jan 22, 2019, 4:14:20 PM1/22/19
to Patrik Iselind, golang-nuts
I'm not sure but I think you will get entries like that for cases for
which an allocation occurred but the memory was then freed by the GC
before the profile record was requested.

Ian

Patrik Iselind

unread,
Jan 23, 2019, 2:29:41 AM1/23/19
to golang-nuts
That seem strange to me. That would mean that the garbage remains, even after it has been collected. That cannot be so...

Patrik Iselind

unread,
Jun 2, 2019, 1:15:35 AM6/2/19
to golang-nuts
The reason I think there are 0: 0 entries is because the profile is fresh but the memory is from the previous GC, which are most likely not the same point in time. Does this make sense?

It seem strange to me that the GC would leave garbage around at random. I don't think it does.
Reply all
Reply to author
Forward
0 new messages