Delete thread pool in NotifyStartupCompleted
Delete the thread pool when startup is completed instead of during
heap trim.
Bug: 120671223
Test: test-art-host
Change-Id: I9715930db7045f46cb70b7fd71b33c00a61b7ac4
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 8335799..5c171e6 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -1422,11 +1422,6 @@
TrimSpaces(self);
// Trim arenas that may have been used by JIT or verifier.
runtime->GetArenaPool()->TrimMaps();
- {
- // TODO: Move this to a callback called when startup is finished (b/120671223).
- ScopedTrace trace2("Delete thread pool");
- runtime->DeleteThreadPool();
- }
}
class TrimIndirectReferenceTableClosure : public Closure {
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 6ab5d98..5539205 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -2784,6 +2784,12 @@
// Notify the profiler saver that startup is now completed.
ProfileSaver::NotifyStartupCompleted();
+
+ {
+ // Delete the thread pool used for app image loading startup is completed.
+ ScopedTrace trace2("Delete thread pool");
+ DeleteThreadPool();
+ }
}
bool Runtime::GetStartupCompleted() const {