Когда инструмент (такой как memcheck, массив, ...) заменяет функции выделения памяти (mallo c, free, ...), тогда valgrind предоставляет опцию:
--xtree-memory=none|allocs|full profile heap memory in an xtree [none]
and produces a report at the end of the execution
none: no profiling, allocs: current allocated
size/blocks, full: profile current and cumulative
allocated size/blocks and freed size/blocks.
--xtree-memory-file=<file> xtree memory report file [xtmemory.kcg.%p]
Итак, если вы используете --xtree-memory = full, вы получите файл, который вы можете визуализировать с помощью kcachegrind. Результирующий файл содержит подробные сведения о том, что выделено в данный момент, а также что было выделено и затем освобождено.
См. http://www.valgrind.org/docs/manual/manual-core.html#manual -core.xtree для получения более подробной информации.