I'm using callgrind in order to profile a C++ program. The program has a very complex main method (which solves an NP-complete problem), and with large problems it becomes the main resource hogger of the application (96% of time in this one method of approximately 120 lines).
While I don't expect miracles as the problem is hard, the method spends 60% of its time making allocations/deallocations. Thus, I wanted to try to understand where/how exactly the memory was being requested so that I can decide if there is a better way to implement it.
Callgrind however does not seem to be able to give me this information. Is there any way I could obtain it? I'm on Linux, and I'm not using an IDE (just vim and g++).
EDIT: I've looked at the suggested duplicate question (track C++ memory allocations). However, it doesn't look like it's what I need, unless I am misunderstanding. Massif looks like a tool to track memory usage; the memory usage of my application is relatively constant (around 1MB total max), but I have constant small allocations/deallocations that I don't know the origin, only the general whereabouts. I don't care about who has my memory in a given snapshot, I care about who keeps allocating and deallocating all the time. Can Massif be used to track these?