Index: src/zone/accounting-allocator.cc |
diff --git a/src/zone/accounting-allocator.cc b/src/zone/accounting-allocator.cc |
index 25ccb3090b3cbd5723536193d436c390e31ab6fd..5d6fda163b785844c34b735db331a117bb455c06 100644 |
--- a/src/zone/accounting-allocator.cc |
+++ b/src/zone/accounting-allocator.cc |
@@ -84,6 +84,10 @@ size_t AccountingAllocator::GetMaxMemoryUsage() const { |
return base::NoBarrier_Load(&max_memory_usage_); |
} |
+size_t AccountingAllocator::GetCurrentPoolSize() const { |
+ return base::NoBarrier_Load(¤t_pool_size_); |
+} |
+ |
Segment* AccountingAllocator::GetSegmentFromPool(size_t requested_size) { |
if (requested_size > (1 << kMaxSegmentSizePower)) { |
return nullptr; |
@@ -106,7 +110,8 @@ Segment* AccountingAllocator::GetSegmentFromPool(size_t requested_size) { |
segment->set_next(nullptr); |
unused_segments_sizes[power]--; |
- unused_segments_size_ -= segment->size(); |
+ base::NoBarrier_AtomicIncrement( |
+ ¤t_pool_size_, -static_cast<base::AtomicWord>(segment->size())); |
} |
} |
@@ -139,7 +144,7 @@ bool AccountingAllocator::AddSegmentToPool(Segment* segment) { |
segment->set_next(unused_segments_heads_[power]); |
unused_segments_heads_[power] = segment; |
- unused_segments_size_ += size; |
+ base::NoBarrier_AtomicIncrement(¤t_pool_size_, size); |
unused_segments_sizes[power]++; |
} |