heaptrack: show allocation data by C++ type
Open, NormalPublic

Description

would be really cool to somehow figure out what type got allocated in a C++ application via "operator new". Sadly, I don't think we can get that information directly from a backtrace (i.e. we'll only see the _Znwm* symbols). Indirectly, it could be feasible though:

int foo()
{
  auto a = malloc(sizeof(uint64_t));
  auto b = malloc(sizeof(uint64_t) * 100);
  auto c = new int;
  auto d = new char[100];
}

with debug symbols, we'll see that loc 3 calls operator new. We can then try to find and open the corresponding source file, and then do a very simple parse run over the line. In all of these cases, we should be able to find the corresponding data type. Then we can (I think) somehow get the size of that type from the DWARF information and then device the requested size by that to find out how many instances where allocated.

mwolff created this task.Mar 1 2016, 5:09 PM