|
From: Matt F. <fa...@ea...> - 2011-05-16 15:16:21
|
At the end of a run (--tool=memcheck) Valgrind prints heap allocation info such as: "total heap usage: 486 allocs, 473 frees, 82,166 bytes allocated" Massif allows one to gather data about total instantaneous heap usage at particular sampling times during program execution. However, I have another (common?) use-case that I'm not sure is addressed. In particular, the "82,166 bytes allocated" refers to the cumulative sum of _all_ heap allocations, including temporaries. Accidentally allocating temporaries on the heap can be a large performance issue. With some languages (e.g., C++) it can also be fairly difficult to track down in a large program (e.g., a missing "&"). Is there some way to get a callgrind-like output for total heap allocations performed by each function? It could be broken down into "self" and "total" (e.g., those internal to the procedure, and those that persist after the procedure exits). Such data would be very useful in tracking down heap allocation bugs. As of yet I have not been able to find any such capability. Thank you for a great tool! - Matt Fago |