summaryrefslogtreecommitdiff
path: root/runtime/base/arena_allocator.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2016-02-23 10:52:23 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-02-23 10:52:23 +0000
commite4c77b4d37024c1ed74e72494e69605942fead61 (patch)
tree5f0de5a63585b661ec0e551c6d172a441150569f /runtime/base/arena_allocator.cc
parent08e992e41e5e234ecc6b38a4ab53d4876fd077b6 (diff)
parentca76a1a0c1737b3e04961ba382c113102fdc00bf (diff)
Merge "Dex-wide ArenaPool scoping for AOT compilation"
Diffstat (limited to 'runtime/base/arena_allocator.cc')
-rw-r--r--runtime/base/arena_allocator.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/base/arena_allocator.cc b/runtime/base/arena_allocator.cc
index 771b2d0509..a4b38ea963 100644
--- a/runtime/base/arena_allocator.cc
+++ b/runtime/base/arena_allocator.cc
@@ -222,6 +222,10 @@ ArenaPool::ArenaPool(bool use_malloc, bool low_4gb)
}
ArenaPool::~ArenaPool() {
+ ReclaimMemory();
+}
+
+void ArenaPool::ReclaimMemory() {
while (free_arenas_ != nullptr) {
auto* arena = free_arenas_;
free_arenas_ = free_arenas_->next_;
@@ -229,6 +233,11 @@ ArenaPool::~ArenaPool() {
}
}
+void ArenaPool::LockReclaimMemory() {
+ MutexLock lock(Thread::Current(), lock_);
+ ReclaimMemory();
+}
+
Arena* ArenaPool::AllocArena(size_t size) {
Thread* self = Thread::Current();
Arena* ret = nullptr;