Reputation: 2827
I see massif can measure heap use, and also stack use with some options. Does it also report global data consumption (the data defined as global or static variables)?
Upvotes: 0
Views: 247
Reputation: 94445
Does it also report global data consumption (the data defined as global or static variables)?
No, Massif is heap-only tool and does not measure .data and .bss sections, and directly mmap-ed memory (but it may measure stack which is used to store some local variables and by alloca
):
http://valgrind.org/docs/manual/ms-manual.html
Massif is a heap profiler. It measures how much heap memory your program uses. This includes both the useful space, and the extra bytes allocated for book-keeping and alignment purposes. It can also measure the size of your program's stack(s), although it does not do so by default. ...
9.2.8. Measuring All Memory in a Process
It is worth emphasising that by default Massif measures only heap memory, i.e. memory allocated with
malloc
,calloc
,realloc
,memalign
,new
,new[]
, and a few other, similar functions. (And it can optionally measure stack memory, of course.) This means it does not directly measure memory allocated with lower-level system calls such asmmap
,mremap
, andbrk
. ...
--stacks=<yes|no> [default: no]
Specifies whether stack profiling should be done. This option slows Massif down greatly, and so is off by default. Note that Massif assumes that the main stack has size zero at start-up. This is not true, but doing otherwise accurately is difficult. Furthermore, starting at zero better indicates the size of the part of the main stack that a user program actually has control over.
Upvotes: 1