Bug 1930253 - CleanupPhase should clear the graph first and only after that free snow whites, r=mccr8

Differential Revision: https://phabricator.services.mozilla.com/D228491
This commit is contained in:
Olli Pettay 2024-11-08 21:57:55 +00:00
parent 24010340a8
commit 4a67fb0ef5

View File

@ -3507,6 +3507,9 @@ void nsCycleCollector::CleanupAfterCollection() {
mGraph.Clear();
timeLog.Checkpoint("CleanupAfterCollection::mGraph.Clear()");
FreeSnowWhite(true);
timeLog.Checkpoint("Collect::FreeSnowWhite");
TimeStamp endTime = TimeStamp::Now();
uint32_t interval = (uint32_t)((endTime - mCollectionStart).ToMilliseconds());
#ifdef COLLECT_TIME_DEBUG
@ -3602,7 +3605,11 @@ bool nsCycleCollector::Collect(CCReason aReason, ccIsManual aIsManual,
// If the CC started idle, it will call BeginCollection, which
// will do FreeSnowWhite, so it doesn't need to be done here.
if (!startedIdle) {
//
// If we're in CleanupPhase, we want to clear the graph before
// FreeSnowWhite runs, so that we don't need to remove objects from the graph
// one by one. CleanupAfterCollection will call FreeSnowWhite.
if (!startedIdle && mIncrementalPhase != CleanupPhase) {
TimeLog timeLog;
FreeSnowWhite(true);
timeLog.Checkpoint("Collect::FreeSnowWhite");