Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: src/zone/accounting-allocator.cc

Issue 2377943003: Fixed zapping of contents (Closed)
Patch Set: Reaction to comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/v8.gyp ('k') | src/zone/zone.cc » ('j') | src/zone/zone.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/zone/accounting-allocator.h" 5 #include "src/zone/accounting-allocator.h"
6 6
7 #include <cstdlib> 7 #include <cstdlib>
8 8
9 #if V8_LIBC_BIONIC 9 #if V8_LIBC_BIONIC
10 #include <malloc.h> // NOLINT 10 #include <malloc.h> // NOLINT
(...skipping 11 matching lines...) Expand all
22 while (current > max) { 22 while (current > max) {
23 max = base::NoBarrier_CompareAndSwap(&max_memory_usage_, max, current); 23 max = base::NoBarrier_CompareAndSwap(&max_memory_usage_, max, current);
24 } 24 }
25 } 25 }
26 return reinterpret_cast<Segment*>(memory); 26 return reinterpret_cast<Segment*>(memory);
27 } 27 }
28 28
29 void AccountingAllocator::FreeSegment(Segment* memory) { 29 void AccountingAllocator::FreeSegment(Segment* memory) {
30 base::NoBarrier_AtomicIncrement( 30 base::NoBarrier_AtomicIncrement(
31 &current_memory_usage_, -static_cast<base::AtomicWord>(memory->size())); 31 &current_memory_usage_, -static_cast<base::AtomicWord>(memory->size()));
32 memory->ZapHeader();
32 free(memory); 33 free(memory);
33 } 34 }
34 35
35 size_t AccountingAllocator::GetCurrentMemoryUsage() const { 36 size_t AccountingAllocator::GetCurrentMemoryUsage() const {
36 return base::NoBarrier_Load(&current_memory_usage_); 37 return base::NoBarrier_Load(&current_memory_usage_);
37 } 38 }
38 39
39 size_t AccountingAllocator::GetMaxMemoryUsage() const { 40 size_t AccountingAllocator::GetMaxMemoryUsage() const {
40 return base::NoBarrier_Load(&max_memory_usage_); 41 return base::NoBarrier_Load(&max_memory_usage_);
41 } 42 }
42 43
43 } // namespace internal 44 } // namespace internal
44 } // namespace v8 45 } // namespace v8
OLDNEW
« no previous file with comments | « src/v8.gyp ('k') | src/zone/zone.cc » ('j') | src/zone/zone.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698