On Fri, 2016-09-16 at 15:37 +0000, Nicholas Lamb wrote:
> I think Memcheck actually can say something about accessible but unreleased
> blocks, but by default it doesn't.
> The show-leak-kinds option, according to the Valgrind manual, can contain the
> 'reachable' value. In this case,
> Memcheck reports blocks that could have been freed but weren't.
Yes, this is correct : memcheck --show-leak-kinds=... option can show
the allocated not (yet) released memory. To find (small) increase of
reachable memory (e.g. in regression tests), you can even do a
'delta leak search' showing the difference with the memory state at the
previous leak search.
> I suppose the advantage of Massif is that it reveals the breakdown of heap
> memory distribution,
> so you can know how much memory is taken by accessible but unreleased
> blocks. I'm using a
> variant of the Eclipse IDE that provides good visualization of Massif's
> output, so I guess
> it's just a matter of examining the detailed snapshots to find memory blocks
> that account
> for a large portion of overall used memory but haven't been used for a while.
Effectively, the main differences between massif and memcheck leak
* massif reports the memory use in a 'tree like layout' which
gives a better visualisation that the memcheck 'flat report' given
per allocation stack trace.
* massif makes reports at regular interval to show memory usage
evolution, and shows the peak usage.
* memcheck delta leak search is more precise to detect small
Note that I am busy adding an 'execution tree' module
that generalises the way massif records and present 'numbers'.
The idea is that such an xtree can be used by various tools
(a.o. memcheck and massif). Various output format will be available
for an xtree (callgrind format, massif format, ..).
memcheck can already produce a
'kcachegrind/callgrind memory status'.
I have just started implementing the massif output format.
I will then change massif to use this module rather than its
After that, probably that all tools that are tracking malloc/free
(memcheck, helgrind, ...) will be able to produce massif like
memory reports with very little additional code.
This is all (evening) work in progress, estimate time of arrival
Valgrind-users mailing list