aboutsummaryrefslogtreecommitdiff
path: root/src/leveldb/util/arena.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2016-12-01 16:14:45 -0800
committerPieter Wuille <pieter.wuille@gmail.com>2016-12-01 16:14:45 -0800
commit605d701471c3ee84682b0c149e41142d7cea95e7 (patch)
tree7a6af0e78ee2202f510686e9a3561c28829b8a4b /src/leveldb/util/arena.h
parentdc6dee41f7cf2ba93fcd0fea7c157e4b2775d439 (diff)
parent634ad517037b319147816f1d112b066528e1724a (diff)
downloadbitcoin-605d701471c3ee84682b0c149e41142d7cea95e7.tar.xz
Merge in LevelDB 1.19 changes
Diffstat (limited to 'src/leveldb/util/arena.h')
-rw-r--r--src/leveldb/util/arena.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/leveldb/util/arena.h b/src/leveldb/util/arena.h
index 73bbf1cb9b..48bab33741 100644
--- a/src/leveldb/util/arena.h
+++ b/src/leveldb/util/arena.h
@@ -9,6 +9,7 @@
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
+#include "port/port.h"
namespace leveldb {
@@ -24,10 +25,9 @@ class Arena {
char* AllocateAligned(size_t bytes);
// Returns an estimate of the total memory usage of data allocated
- // by the arena (including space allocated but not yet used for user
- // allocations).
+ // by the arena.
size_t MemoryUsage() const {
- return blocks_memory_ + blocks_.capacity() * sizeof(char*);
+ return reinterpret_cast<uintptr_t>(memory_usage_.NoBarrier_Load());
}
private:
@@ -41,8 +41,8 @@ class Arena {
// Array of new[] allocated memory blocks
std::vector<char*> blocks_;
- // Bytes of memory in blocks allocated so far
- size_t blocks_memory_;
+ // Total memory usage of the arena.
+ port::AtomicPointer memory_usage_;
// No copying allowed
Arena(const Arena&);