Change MemMap::maps_ to not be global variable
Runtime.exit() was causing globals to get destructed at the same time
that another thread was using it for allocating a new mem map.
Bug: 17962201
Change-Id: I400cb7b8141d858f3c08a6fe59a02838c04c6962
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 42d05a9..3bd825b 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -193,6 +193,7 @@
Thread::Shutdown();
QuasiAtomic::Shutdown();
verifier::MethodVerifier::Shutdown();
+ MemMap::Shutdown();
// TODO: acquire a static mutex on Runtime to avoid racing.
CHECK(instance_ == nullptr || instance_ == this);
instance_ = nullptr;
@@ -645,6 +646,8 @@
bool Runtime::Init(const RuntimeOptions& raw_options, bool ignore_unrecognized) {
CHECK_EQ(sysconf(_SC_PAGE_SIZE), kPageSize);
+ MemMap::Init();
+
std::unique_ptr<ParsedOptions> options(ParsedOptions::Create(raw_options, ignore_unrecognized));
if (options.get() == nullptr) {
LOG(ERROR) << "Failed to parse options";