ubuntuvalgrindmassif

valgrind massif heap profiler no detailed snapshot view - how do you zoom in/out?


So I am trying to see my heap memory usage for my c++ program in Ubuntu 18

I have run it using:

valgrind --tool=massif --smc-check=all ./myprogram

I get quite a large output, which is ok. I view it using massif-visualizer.

I get a pretty graph and all that. But I want to look in detail at the end of my program to see how well it shutsdown. But I can't seem to zoom in on the graph view and I see no option to do this.

The manpage(here) says this:

Massif generates a few detailed snapshots that essentially make up the tree. If you want to get an overview in a more comfortable way than the simple tree view, switch over to the detailed snapshot tab and see the tree visualized as a call graph. Zoom in, zoom out, use the birds eye view and see what contributes to a given snapshot. Note that function calls with the same memory cost are grouped to easily find the interesting parts.

But I can't see an option to "switch over to the detailed snapshot tab"... does anyone else know how to do that?

Ubuntu 18

massif-visualizer 0.7


Solution

  • Instead of massif visualiser, you might use kcachegrind to visualise the memory using the new 'xtree feature' that appeared in valgrind 3.13.

    Here is an extract of valgrind --help:

      user options for Valgrind tools that replace malloc:
        --alignment=<number>      set minimum alignment of heap allocations [16]
        --redzone-size=<number>   set minimum size of redzones added before/after
                                  heap blocks (in bytes). [16]
        --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]
    

    See http://www.valgrind.org/docs/manual/manual-core.html#manual-core.xtree for more information.