endif()
set(HEAPTRACK_VERSION_MAJOR 1)
-set(HEAPTRACK_VERSION_MINOR 1)
+set(HEAPTRACK_VERSION_MINOR 2)
set(HEAPTRACK_VERSION_PATCH 0)
set(HEAPTRACK_LIB_VERSION 1.0.0)
set(HEAPTRACK_LIB_SOVERSION 1)
// newer versions handle this in heaptrack_interpret already
AllocationInfoSet allocationInfoSet;
PointerMap pointers;
+ // in older files, this contains the pointer address, in newer formats
+ // it holds the allocation info index. both can be used to find temporary
+ // allocations, i.e. when a deallocation follows with the same data
uint64_t lastAllocationPtr = 0;
while (reader.getLine(in)) {
continue;
}
info = allocationInfos[allocationIndex.index];
+ lastAllocationPtr = allocationIndex.index;
} else { // backwards compatibility
uint64_t ptr = 0;
if (!(reader >> info.size) || !(reader >> info.traceIndex) || !(reader >> ptr)) {
cerr << "failed to parse line: " << reader.line() << endl;
continue;
}
- // optional, and thus may fail.
- // but that's OK since we default to false anyways
- reader >> temporary;
+ temporary = lastAllocationPtr == allocationInfoIndex.index;
} else { // backwards compatibility
uint64_t ptr = 0;
if (!(reader >> ptr)) {
}
allocationInfoIndex = taken.first;
temporary = lastAllocationPtr == ptr;
- lastAllocationPtr = 0;
}
+ lastAllocationPtr = 0;
const auto& info = allocationInfos[allocationInfoIndex.index];
auto& allocation = findAllocation(info.traceIndex);
if (!allocation.second) {
continue;
}
- fprintf(stdout, "- %x", allocation.first.index);
+ fprintf(stdout, "- %x\n", allocation.first.index);
if (temporary) {
++temporaryAllocations;
- fputs(" 1\n", stdout);
- } else {
- fputc('\n', stdout);
}
} else {
fputs(reader.line().c_str(), stdout);