// Delete the thread pool used for app image loading since startup is assumed to be completed.
ScopedTrace trace2("Delete thread pool");
Runtime::Current()->DeleteThreadPool();
}
// Fetch the startup linear alloc so no other thread tries to allocate there.
std::unique_ptr<LinearAlloc> startup_linear_alloc(runtime->ReleaseStartupLinearAlloc()); // No thread could be allocating arrays or accessing dex caches when this // thread has mutator-lock held exclusively. bool run_checkpoints = !Locks::mutator_lock_->IsExclusiveHeld(self);
// Request a checkpoint to make sure all threads see we have started up and // won't allocate in the startup linear alloc. Without this checkpoint what // could happen is (T0 == self): // 1) T1 fetches startup alloc, allocates an array there. // 2) T0 goes over the dex caches, clear dex cache arrays in the startup alloc. // 3) T1 sets the dex cache array from startup alloc in a dex cache. // 4) T0 releases startup alloc. // // With this checkpoint, 3) cannot happen as T0 waits for T1 to reach the // checkpoint. if (run_checkpoints) {
runtime->GetThreadList()->RunCheckpoint(&closure);
}
// Request a checkpoint to make sure no threads are: // - accessing the image space metadata section when we madvise it // - accessing dex caches when we free them if (run_checkpoints) {
runtime->GetThreadList()->RunCheckpoint(&closure);
}
// If this isn't the GC calling `DeleteStartupDexCaches` and a GC may be // running, wait for it to be complete. We don't want it to see these dex // caches. Since we are runnable, a GC started after this cannot get far. if (!called_by_gc) {
runtime->GetHeap()->WaitForGcToComplete(gc::kGcCauseDeletingDexCacheArrays, self);
}
// At this point, we know no other thread can see the arrays, nor the GC. So // we can safely release them. for (gc::space::ContinuousSpace* space : runtime->GetHeap()->GetContinuousSpaces()) { if (space->IsImageSpace()) {
gc::space::ImageSpace* image_space = space->AsImageSpace(); if (image_space->GetImageHeader().IsAppImage()) {
image_space->ReleaseMetadata();
}
}
}
if (startup_linear_alloc != nullptr) {
ScopedTrace trace2("Delete startup linear alloc");
ArenaPool* arena_pool = startup_linear_alloc->GetArenaPool();
startup_linear_alloc.reset();
arena_pool->TrimMaps();
}
}
} // namespace art
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.