Add one LinearAlloc per ClassLoader
Also added freeing linear alloc and class table when the
corresponding class loader is no longer reachable.
Bug: 22720414
Change-Id: Icb32c3a4c865f240e147bc87ed080a6b1d8a5795
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 6b144cf..ccfc4bc 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -944,10 +944,8 @@
if (IsCompiler() && Is64BitInstructionSet(kRuntimeISA)) {
// 4gb, no malloc. Explanation in header.
low_4gb_arena_pool_.reset(new ArenaPool(false, true));
- linear_alloc_.reset(new LinearAlloc(low_4gb_arena_pool_.get()));
- } else {
- linear_alloc_.reset(new LinearAlloc(arena_pool_.get()));
}
+ linear_alloc_.reset(CreateLinearAlloc());
BlockSignals();
InitPlatformSignalHandlers();
@@ -1788,4 +1786,10 @@
return verify_ == verifier::VerifyMode::kSoftFail;
}
+LinearAlloc* Runtime::CreateLinearAlloc() {
+ return (IsCompiler() && Is64BitInstructionSet(kRuntimeISA))
+ ? new LinearAlloc(low_4gb_arena_pool_.get())
+ : new LinearAlloc(arena_pool_.get());
+}
+
} // namespace art