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

Side by Side Diff: src/base/accounting-allocator.h

Issue 2299753002: Made zone segments aligned in memory and included a pointer to the zone in the header. Larger objec…
Patch Set: Added a zone segment pool for small segments to avoid frequent sys calls Created 4 years, 3 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 | « no previous file | src/base/accounting-allocator.cc » ('j') | no next file with comments »
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 #ifndef V8_BASE_ACCOUNTING_ALLOCATOR_H_ 5 #ifndef V8_BASE_ACCOUNTING_ALLOCATOR_H_
6 #define V8_BASE_ACCOUNTING_ALLOCATOR_H_ 6 #define V8_BASE_ACCOUNTING_ALLOCATOR_H_
7 7
8 #include "src/base/atomicops.h" 8 #include "src/base/atomicops.h"
9 #include "src/base/macros.h" 9 #include "src/base/macros.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace base { 12 namespace base {
13 13
14 class AccountingAllocator { 14 class AccountingAllocator {
15 public: 15 public:
16 AccountingAllocator() = default; 16 AccountingAllocator() = default;
17 virtual ~AccountingAllocator() = default; 17 virtual ~AccountingAllocator() = default;
18 18
19 // Returns nullptr on failed allocation. 19 // Returns nullptr on failed allocation.
20 virtual void* Allocate(size_t bytes); 20 virtual void* Allocate(size_t bytes);
21 virtual void Free(void* memory, size_t bytes); 21 virtual void Free(void* memory, size_t bytes);
22 22
23 virtual void ChangeCurrentMemoryUsage(const int64_t);
24
23 size_t GetCurrentMemoryUsage() const; 25 size_t GetCurrentMemoryUsage() const;
24 size_t GetMaxMemoryUsage() const; 26 size_t GetMaxMemoryUsage() const;
25 27
26 private: 28 private:
27 AtomicWord current_memory_usage_ = 0; 29 AtomicWord current_memory_usage_ = 0;
28 AtomicWord max_memory_usage_ = 0; 30 AtomicWord max_memory_usage_ = 0;
29 31
30 DISALLOW_COPY_AND_ASSIGN(AccountingAllocator); 32 DISALLOW_COPY_AND_ASSIGN(AccountingAllocator);
31 }; 33 };
32 34
33 } // namespace base 35 } // namespace base
34 } // namespace v8 36 } // namespace v8
35 37
36 #endif // V8_BASE_ACCOUNTING_ALLOCATOR_H_ 38 #endif // V8_BASE_ACCOUNTING_ALLOCATOR_H_
OLDNEW
« no previous file with comments | « no previous file | src/base/accounting-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698