Skip to content

Commit

Permalink
More useful leak debugging output.
Browse files Browse the repository at this point in the history
When printing out leaked allocations, print the allocation tag and address of
the returned pointer.
  • Loading branch information
robarnold committed Jul 28, 2011
1 parent 1950778 commit f45ac8d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/rt/memory_region.cpp
Expand Up @@ -130,8 +130,10 @@ memory_region::~memory_region() {
if (_detailed_leaks) {
for (size_t i = 0; i < _allocation_list.size(); i++) {
if (_allocation_list[i] != NULL) {
printf("allocation 0x%" PRIxPTR " was not freed\n",
(uintptr_t) _allocation_list[i]);
alloc_header *header = (alloc_header*)_allocation_list[i];
printf("allocation (%s) 0x%" PRIxPTR " was not freed\n",
header->tag,
(uintptr_t) &header->data);
}
}
}
Expand Down

0 comments on commit f45ac8d

Please sign in to comment.