Bug 1188834 - Make compacting GC when inactive less frequent except on nightly r=smaug

This commit is contained in:
Jon Coppeard 2015-07-30 11:03:06 +01:00
parent d4df6b7824
commit b113657091
2 changed files with 14 additions and 4 deletions

View File

@ -112,9 +112,9 @@ const size_t gStackSize = 8192;
#define NS_FULL_GC_DELAY 60000 // ms
// The amount of time to wait from the user being idle to starting a shrinking
// GC.
#define NS_SHRINKING_GC_DELAY 15000 // ms
// The default amount of time to wait from the user being idle to starting a
// shrinking GC.
#define NS_DEAULT_INACTIVE_GC_DELAY 300000 // ms
// Maximum amount of time that should elapse between incremental GC slices
#define NS_INTERSLICE_GC_DELAY 100 // ms
@ -221,6 +221,7 @@ static bool sGCOnMemoryPressure;
// after NS_SHRINKING_GC_DELAY ms later, if the appropriate pref is set.
static bool sCompactOnUserInactive;
static uint32_t sCompactOnUserInactiveDelay = NS_DEAULT_INACTIVE_GC_DELAY;
static bool sIsCompactingOnUserInactive = false;
// In testing, we call RunNextCollectorTimer() to ensure that the collectors are run more
@ -2097,7 +2098,7 @@ nsJSContext::PokeShrinkingGC()
}
sShrinkingGCTimer->InitWithFuncCallback(ShrinkingGCTimerFired, nullptr,
NS_SHRINKING_GC_DELAY,
sCompactOnUserInactiveDelay,
nsITimer::TYPE_ONE_SHOT);
}
@ -2855,6 +2856,10 @@ nsJSContext::EnsureStatics()
"javascript.options.compact_on_user_inactive",
true);
Preferences::AddUintVarCache(&sCompactOnUserInactiveDelay,
"javascript.options.compact_on_user_inactive_delay",
NS_DEAULT_INACTIVE_GC_DELAY);
nsIObserver* observer = new nsJSEnvironmentObserver();
obs->AddObserver(observer, "memory-pressure", false);
obs->AddObserver(observer, "user-interaction-inactive", false);

View File

@ -1141,6 +1141,11 @@ pref("javascript.options.mem.log", false);
pref("javascript.options.mem.notify", false);
pref("javascript.options.gc_on_memory_pressure", true);
pref("javascript.options.compact_on_user_inactive", true);
#ifdef NIGHTLY_BUILD
pref("javascript.options.compact_on_user_inactive_delay", 15000); // ms
#else
pref("javascript.options.compact_on_user_inactive_delay", 300000); // ms
#endif
pref("javascript.options.mem.gc_high_frequency_time_limit_ms", 1000);
pref("javascript.options.mem.gc_high_frequency_low_limit_mb", 100);