Index: third_party/tcmalloc/chromium/src/heap-profile-table.cc |
diff --git a/third_party/tcmalloc/chromium/src/heap-profile-table.cc b/third_party/tcmalloc/chromium/src/heap-profile-table.cc |
index 893fd4e98a26e365d77fab4dd4460698513c93c8..748aa8c85b4188390bc75cdf3dab6e8b209841df 100644 |
--- a/third_party/tcmalloc/chromium/src/heap-profile-table.cc |
+++ b/third_party/tcmalloc/chromium/src/heap-profile-table.cc |
@@ -129,6 +129,11 @@ HeapProfileTable::HeapProfileTable(Allocator alloc, DeAllocator dealloc) |
// Make allocation map |
allocation_ = |
new(alloc_(sizeof(AllocationMap))) AllocationMap(alloc_, dealloc_); |
+ |
+ allocation_mmap_ = |
+ new(alloc_(sizeof(AllocationMap))) AllocationMap(alloc_, dealloc_); |
+ mmap_record_ = false; |
+ |
// init the rest: |
memset(&total_, 0, sizeof(total_)); |
num_buckets_ = 0; |
@@ -139,6 +144,11 @@ HeapProfileTable::~HeapProfileTable() { |
allocation_->~AllocationMap(); |
dealloc_(allocation_); |
allocation_ = NULL; |
+ |
+ allocation_mmap_->~AllocationMap(); |
+ dealloc_(allocation_mmap_); |
+ allocation_mmap_ = NULL; |
+ |
// free hash table |
for (int b = 0; b < kHashTableSize; b++) { |
for (Bucket* x = table_[b]; x != 0; /**/) { |
@@ -209,12 +219,22 @@ void HeapProfileTable::RecordAllocWithStack( |
AllocValue v; |
v.set_bucket(b); // also did set_live(false); set_ignore(false) |
v.bytes = bytes; |
- allocation_->Insert(ptr, v); |
+ |
+ if(mmap_record_) |
+ allocation_mmap_->Insert(ptr, v); |
+ else |
+ allocation_->Insert(ptr, v); |
} |
void HeapProfileTable::RecordFree(const void* ptr) { |
AllocValue v; |
- if (allocation_->FindAndRemove(ptr, &v)) { |
+ AllocationMap* a; |
+ if(mmap_record_) |
+ a = allocation_mmap_; |
+ else |
+ a = allocation_; |
+ |
+ if(a->FindAndRemove(ptr, &v)){ |
Bucket* b = v.bucket(); |
b->frees++; |
b->free_size += v.bytes; |