I need to review the memory consumption of a certain part of a program. At this point I don't care about leaks but simply about when the program allocates which objects in heap. I can trace the allocation back to certain methods but now I need to zoom in closer. Ideally I would like to step debug the code to reach the critical section and for every further step get an update on what memory has been allocated and where.
I tried using valgrind --massif in different ways. The closest I got was using vgdb and forcing a snapshot before and after the section I'm interested in and then comparing those manually in massif-visualizer. However I seem to be unable to set thresholds or ignore methods in a way that a small allocation (<1mB) is visible since the programm allocates a few hundred mB during startup.
I also tried gperftools heapprofiler but didn't get much further.
(I also tried heaptrack but so far failed to compile the gui tools)
I feel like I'm missing something here and make things more complicated than they have to be. How can I check heap allocation while step debugging through my application?
CentOS7 3.10, gcc 4.8.5
Update: This is a recurring task and I cannot always recompile the sw. I'm looking for a general solution that can be efficiently repeated with when analyzing "strange" memory consumption. Commercial tools would be ok as well as long as they def. get the job done.