Index: src/profiler/sampling-heap-profiler.cc |
diff --git a/src/profiler/sampling-heap-profiler.cc b/src/profiler/sampling-heap-profiler.cc |
index a32cae3ef9c926c77aa448d614ca7ed2793cbec7..61e4897b31d8e4431f7cbf5500c4bb53970c50f2 100644 |
--- a/src/profiler/sampling-heap-profiler.cc |
+++ b/src/profiler/sampling-heap-profiler.cc |
@@ -117,6 +117,9 @@ void SamplingHeapProfiler::OnWeakCallback( |
AllocationNode* node = sample->owner; |
DCHECK(node->allocations_[sample->size] > 0); |
node->allocations_[sample->size]--; |
+ if (node->allocations_[sample->size] == 0) { |
+ node->allocations_.erase(sample->size); |
+ } |
sample->profiler->samples_.erase(sample); |
delete sample; |
} |