Trim maps after releasing the startup linear alloc.
Return the memory directly instead of waiting for the OS to do so. This
also stabilizes our memory measurements.
Test: test.py
Bug: 256261573
Change-Id: Ie75ffc40fa87575e9316c4cb030ce06351b508af
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 2aed680..42522ee 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -3455,11 +3455,13 @@
runtime->DeleteThreadPool();
}
- {
+ if (startup_linear_alloc != nullptr) {
// We know that after the checkpoint, there is no thread that can hold
// the startup linear alloc, so it's safe to delete it now.
ScopedTrace trace2("Delete startup linear alloc");
+ ArenaPool* arena_pool = startup_linear_alloc->GetArenaPool();
startup_linear_alloc.reset();
+ arena_pool->TrimMaps();
}
}
};