On 16/09/16 17:37, Nicholas Lamb wrote:

> 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.

You can get yet another kind of insight into your heap behaviour using
the exp-dhat tool.  This observes both heap blocks and the memory accesses
made to them, and so can tell you

* places where blocks are allocated and freed very soon afterwards --
  possible inefficiency -- maybe that data could be stack-allocated

* blocks which are allocated and later freed but remain partially or
  entirely unused, or under-used.  From this information you can find
  sometimes surprising facts like (for example) "50% of our hash tables
  never have any entries in them", etc.


Valgrind-users mailing list

Reply via email to