Skip to content

Commit

Permalink
Add memory waste info for top command
Browse files Browse the repository at this point in the history
  • Loading branch information
larryhou committed Nov 25, 2019
1 parent 4804b21 commit b3c47c8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion MemoryCrawler/MemoryCrawler/Crawler/crawler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,13 +625,17 @@ void MemorySnapshotCrawler::topMObjects(int32_t rank, address_t address, bool ke
});
}

address_t prevAddress = 0;
for (auto i = 0; i < rank; i++)
{
auto mo = objects[i];
if (i >= objects.size()) {break;}

auto &type = snapshot->typeDescriptions->items[mo->typeIndex];
printf("0x%llx %s %s\n", mo->address, type.name.c_str(), comma(mo->size).c_str());
printf("0x%llx %s %s", mo->address, type.name.c_str(), comma(mo->size).c_str());
if (keepAddressOrder && prevAddress != 0) { printf(" +%lld", mo->address - prevAddress); }
printf("\n");
prevAddress = mo->address + mo->size;
}
}

Expand Down

0 comments on commit b3c47c8

Please sign in to comment.