| Index: src/base/accounting-allocator.cc
|
| diff --git a/src/base/accounting-allocator.cc b/src/base/accounting-allocator.cc
|
| index 2269c60680c0e1d13b542ebbc9a56451382560b5..c56f037c04c00a9e6ec97976a6b0fb614e7cd091 100644
|
| --- a/src/base/accounting-allocator.cc
|
| +++ b/src/base/accounting-allocator.cc
|
| @@ -15,7 +15,14 @@ namespace base {
|
|
|
| void* AccountingAllocator::Allocate(size_t bytes) {
|
| void* memory = malloc(bytes);
|
| - if (memory) NoBarrier_AtomicIncrement(¤t_memory_usage_, bytes);
|
| + if (memory) {
|
| + AtomicWord current =
|
| + NoBarrier_AtomicIncrement(¤t_memory_usage_, bytes);
|
| + AtomicWord max = NoBarrier_Load(&max_memory_usage_);
|
| + while (current > max) {
|
| + max = NoBarrier_CompareAndSwap(&max_memory_usage_, max, current);
|
| + }
|
| + }
|
| return memory;
|
| }
|
|
|
| @@ -29,5 +36,9 @@ size_t AccountingAllocator::GetCurrentMemoryUsage() const {
|
| return NoBarrier_Load(¤t_memory_usage_);
|
| }
|
|
|
| +size_t AccountingAllocator::GetMaxMemoryUsage() const {
|
| + return NoBarrier_Load(&max_memory_usage_);
|
| +}
|
| +
|
| } // namespace base
|
| } // namespace v8
|
|
|