Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

JS_GetGCParameter

Adjust performance parameters related to garbage collection.

Syntax

uint32_t
JS_GetGCParameter(JSRuntime *rt, JSGCParamKey key);

void
JS_SetGCParameter(JSRuntime *rt, JSGCParamKey key, uint32_t value);

uint32_t
JS_GetGCParameterForThread(JSContext *cx, JSGCParamKey key); // Added in SpiderMonkeySidebar 17

void
JS_SetGCParameterForThread(JSContext *cx, JSGCParamKey key, uint32_t value); // Added in SpiderMonkeySidebar 17
Name Type Description
rt JSRuntime * The runtime to configure.
cx JSContext * The context to configure. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
key JSGCParamKey Specifies which garbage collection parameter to get or set.
value uint32_t (JS_SetGCParameter only) The value to assign to the parameter.
typedef enum JSGCParamKey {
    JSGC_MAX_BYTES,
    JSGC_MAX_MALLOC_BYTES,
    JSGC_BYTES,
    JSGC_NUMBER,
    JSGC_MAX_CODE_CACHE_BYTES,
    JSGC_MODE,
    JSGC_UNUSED_CHUNKS,
    JSGC_TOTAL_CHUNKS,
    JSGC_SLICE_TIME_BUDGET,
    JSGC_MARK_STACK_LIMIT,
    JSGC_HIGH_FREQUENCY_TIME_LIMIT,
    JSGC_HIGH_FREQUENCY_LOW_LIMIT,
    JSGC_HIGH_FREQUENCY_HIGH_LIMIT,
    JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MAX,
    JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MIN,
    JSGC_LOW_FREQUENCY_HEAP_GROWTH,
    JSGC_DYNAMIC_HEAP_GROWTH,
    JSGC_DYNAMIC_MARK_SLICE,
    JSGC_ALLOCATION_THRESHOLD,
    JSGC_DECOMMIT_THRESHOLD,
    JSGC_MIN_EMPTY_CHUNK_COUNT,
    JSGC_MAX_EMPTY_CHUNK_COUNT,
} JSGCParamKey;
Value Description
JSGC_MAX_BYTES Maximum nominal heap before last ditch GC.
JSGC_MAX_MALLOC_BYTES Number of JS_malloc bytes before last ditch GC.
JSGC_BYTES Amount of bytes allocated by the GC. Added in SpiderMonkey 1.8.1
JSGC_NUMBER Number of times GC has been invoked. Includes both major and minor GC. Added in SpiderMonkey 1.8.1
JSGC_MAX_CODE_CACHE_BYTES Max size of the code cache in bytes. Added in SpiderMonkey 17
JSGC_MODE Select GC mode. Added in SpiderMonkey 17
JSGC_UNUSED_CHUNKS Number of cached empty GC chunks Added in SpiderMonkey 17.
JSGC_TOTAL_CHUNKS Total number of allocated GC chunks. Added in SpiderMonkey 17
JSGC_SLICE_TIME_BUDGET Max milliseconds to spend in an incremental GC slice. Added in SpiderMonkey 17
JSGC_MARK_STACK_LIMIT Maximum size the GC mark stack can grow to. Added in SpiderMonkey 17
JSGC_HIGH_FREQUENCY_TIME_LIMIT GCs less than this far apart in time will be considered 'high-frequency GCs'. See setGCLastBytes in jsgc.cpp. Added in SpiderMonkey 17
JSGC_HIGH_FREQUENCY_LOW_LIMIT Start of dynamic heap growth. Added in SpiderMonkey 17
JSGC_HIGH_FREQUENCY_HIGH_LIMIT End of dynamic heap growth. Added in SpiderMonkey 17
JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MAX Upper bound of heap growth. Added in SpiderMonkey 17
JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MIN Lower bound of heap growth. Added in SpiderMonkey 17
JSGC_LOW_FREQUENCY_HEAP_GROWTH Heap growth for low frequency GCs. Added in SpiderMonkey 17
JSGC_DYNAMIC_HEAP_GROWTH If false, the heap growth factor is fixed at 3. If true, it is determined based on whether GCs are high- or low- frequency. Added in SpiderMonkey 17
JSGC_DYNAMIC_MARK_SLICE If true, high-frequency GCs will use a longer mark slice. Added in SpiderMonkey 17
JSGC_ALLOCATION_THRESHOLD Lower limit after which we limit the heap growth. Added in SpiderMonkey 24
JSGC_DECOMMIT_THRESHOLD 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. Added in SpiderMonkey 24
JSGC_MIN_EMPTY_CHUNK_COUNT We try to keep at least this many unused chunks in the free chunk pool at all times, even after a shrinking GC. Added in SpiderMonkey 38
JSGC_MAX_EMPTY_CHUNK_COUNT We never keep more than this many unused chunks in the free chunk pool.Added in SpiderMonkey 38

Description

JS_GetGCParameter returns the current parameter of the garbage collection.

If successful, JS_GetGCParameter returns the current parameter.

JS_SetGCParameter ajusts the parameter of the garbage collection.

See Also

Document Tags and Contributors

 Contributors to this page: arai, fscholz, tschneidereit, Jorend, Sheppy
 Last updated by: arai,