From b0a16305a8948fc939113db4a0c760859dabae70 Mon Sep 17 00:00:00 2001 From: Terrence Cole Date: Mon, 23 Feb 2015 14:25:37 -0800 Subject: [PATCH] Bug 1135141 - Do not do background sweeping for zealous GCs to avoid fragmentation; r=jonco --HG-- extra : rebase_source : 4bdc6c9af1b6a34fb7394e2f8d0c884b114b3fee --- js/src/jsgc.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 5995ab666a66..1211f469c95a 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -5576,8 +5576,13 @@ GCRuntime::finishCollection(JS::gcreason::Reason reason) lastGCTime = currentTime; // If this is an OOM GC reason, wait on the background sweeping thread - // before returning to ensure that we free as much as possible. - if (reason == JS::gcreason::LAST_DITCH || reason == JS::gcreason::MEM_PRESSURE) { + // before returning to ensure that we free as much as possible. If this is + // a zeal-triggered GC, we want to ensure that the mutator can continue + // allocating on the same pages to reduce fragmentation. + if (reason == JS::gcreason::LAST_DITCH || + reason == JS::gcreason::MEM_PRESSURE || + reason == JS::gcreason::DEBUG_GC) + { gcstats::AutoPhase ap(stats, gcstats::PHASE_WAIT_BACKGROUND_THREAD); rt->gc.waitBackgroundSweepOrAllocEnd(); }