mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 14:46:02 +00:00
Bug 871005 - Add a pref for GC decommit threshold (r=gregor)
This commit is contained in:
parent
84d2edefb9
commit
2e3db4ed09
@ -563,6 +563,7 @@ pref("javascript.options.mem.gc_high_frequency_low_limit_mb", 10);
|
||||
pref("javascript.options.mem.gc_low_frequency_heap_growth", 120);
|
||||
pref("javascript.options.mem.high_water_mark", 6);
|
||||
pref("javascript.options.mem.gc_allocation_threshold_mb", 1);
|
||||
pref("javascript.options.mem.gc_decommit_threshold_mb", 1);
|
||||
|
||||
// Show/Hide scrollbars when active/inactive
|
||||
pref("ui.showHideScrollbars", 1);
|
||||
|
@ -3430,6 +3430,11 @@ nsJSRuntime::Init()
|
||||
Preferences::RegisterCallbackAndCall(SetMemoryGCPrefChangedCallback,
|
||||
"javascript.options.mem.gc_allocation_threshold_mb",
|
||||
(void *)JSGC_ALLOCATION_THRESHOLD);
|
||||
|
||||
Preferences::RegisterCallbackAndCall(SetMemoryGCPrefChangedCallback,
|
||||
"javascript.options.mem.gc_decommit_threshold_mb",
|
||||
(void *)JSGC_DECOMMIT_THRESHOLD);
|
||||
|
||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||
if (!obs)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -110,12 +110,6 @@ struct Cell
|
||||
inline Chunk *chunk() const;
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the maximum number of arenas we allow in the FreeCommitted state
|
||||
* before we trigger a GC_SHRINK to release free arenas to the OS.
|
||||
*/
|
||||
const static uint32_t FreeCommittedArenasThreshold = (32 << 20) / ArenaSize;
|
||||
|
||||
/*
|
||||
* The mark bitmap has one bit per each GC cell. For multi-cell GC things this
|
||||
* wastes space but allows to avoid expensive devisions by thing's size when
|
||||
|
@ -781,6 +781,7 @@ JSRuntime::JSRuntime(JSUseHelperThreads useHelperThreads)
|
||||
gcLowFrequencyHeapGrowth(1.5),
|
||||
gcDynamicHeapGrowth(false),
|
||||
gcDynamicMarkSlice(false),
|
||||
gcDecommitThreshold(32 * 1024 * 1024),
|
||||
gcShouldCleanUpEverything(false),
|
||||
gcGrayBitsValid(false),
|
||||
gcIsNeeded(0),
|
||||
@ -2891,6 +2892,9 @@ JS_SetGCParameter(JSRuntime *rt, JSGCParamKey key, uint32_t value)
|
||||
case JSGC_ALLOCATION_THRESHOLD:
|
||||
rt->gcAllocationThreshold = value * 1024 * 1024;
|
||||
break;
|
||||
case JSGC_DECOMMIT_THRESHOLD:
|
||||
rt->gcDecommitThreshold = value * 1024 * 1024;
|
||||
break;
|
||||
default:
|
||||
JS_ASSERT(key == JSGC_MODE);
|
||||
rt->gcMode = JSGCMode(value);
|
||||
|
@ -2699,7 +2699,14 @@ typedef enum JSGCParamKey {
|
||||
JSGC_ANALYSIS_PURGE_TRIGGER = 19,
|
||||
|
||||
/* Lower limit after which we limit the heap growth. */
|
||||
JSGC_ALLOCATION_THRESHOLD = 20
|
||||
JSGC_ALLOCATION_THRESHOLD = 20,
|
||||
|
||||
/*
|
||||
* We decommit memory lazily. If more than this number of megabytes is
|
||||
* available to be decommitted, then JS_MaybeGC will trigger a shrinking GC
|
||||
* to decommit it.
|
||||
*/
|
||||
JSGC_DECOMMIT_THRESHOLD = 21
|
||||
} JSGCParamKey;
|
||||
|
||||
typedef enum JSGCMode {
|
||||
|
@ -897,6 +897,7 @@ struct JSRuntime : public JS::shadow::Runtime,
|
||||
double gcLowFrequencyHeapGrowth;
|
||||
bool gcDynamicHeapGrowth;
|
||||
bool gcDynamicMarkSlice;
|
||||
uint64_t gcDecommitThreshold;
|
||||
|
||||
/* During shutdown, the GC needs to clean up every possible object. */
|
||||
bool gcShouldCleanUpEverything;
|
||||
|
@ -1982,7 +1982,7 @@ js::MaybeGC(JSContext *cx)
|
||||
int64_t now = PRMJ_Now();
|
||||
if (rt->gcNextFullGCTime && rt->gcNextFullGCTime <= now) {
|
||||
if (rt->gcChunkAllocationSinceLastGC ||
|
||||
rt->gcNumArenasFreeCommitted > FreeCommittedArenasThreshold)
|
||||
rt->gcNumArenasFreeCommitted > rt->gcDecommitThreshold)
|
||||
{
|
||||
JS::PrepareForFullGC(rt);
|
||||
GCSlice(rt, GC_SHRINK, JS::gcreason::MAYBEGC);
|
||||
|
@ -413,6 +413,7 @@ pref("javascript.options.mem.gc_high_frequency_low_limit_mb", 10);
|
||||
pref("javascript.options.mem.gc_low_frequency_heap_growth", 105);
|
||||
pref("javascript.options.mem.high_water_mark", 16);
|
||||
pref("javascript.options.mem.gc_allocation_threshold_mb", 3);
|
||||
pref("javascript.options.mem.gc_decommit_threshold_mb", 1);
|
||||
#else
|
||||
pref("javascript.options.mem.high_water_mark", 32);
|
||||
#endif
|
||||
|
@ -827,6 +827,7 @@ pref("javascript.options.mem.gc_low_frequency_heap_growth", 150);
|
||||
pref("javascript.options.mem.gc_dynamic_heap_growth", true);
|
||||
pref("javascript.options.mem.gc_dynamic_mark_slice", true);
|
||||
pref("javascript.options.mem.gc_allocation_threshold_mb", 30);
|
||||
pref("javascript.options.mem.gc_decommit_threshold_mb", 32);
|
||||
|
||||
pref("javascript.options.mem.analysis_purge_mb", 100);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user