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_MAX_NURSERY_BYTES,
JSGC_BYTES,
JSGC_NUMBER,
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_MIN_EMPTY_CHUNK_COUNT,
JSGC_MAX_EMPTY_CHUNK_COUNT,
JSGC_COMPACTION_ENABLED,
JSGC_ALLOCATION_THRESHOLD_FACTOR,
JSGC_ALLOCATION_THRESHOLD_FACTOR_AVOID_INTERRUPT,
JSGC_NURSERY_FREE_THRESHOLD_FOR_IDLE_COLLECTION,
JSGC_PRETENURE_THRESHOLD,
JSGC_PRETENURE_GROUP_THRESHOLD,
JSGC_NURSERY_FREE_THRESHOLD_FOR_IDLE_COLLECTION_PERCENT,
JSGC_MIN_NURSERY_BYTES,
JSGC_MIN_LAST_DITCH_GC_PERIOD,
} JSGCParamKey;
Value (C++/JS Shell) | Description |
---|---|
JSGC_MAX_BYTES / "maxBytes" | Maximum nominal heap before last ditch GC. |
JSGC_MAX_MALLOC_BYTES / "maxMallocBytes" | Number of JS_malloc bytes before last ditch GC. |
JSGC_MAX_NURSERY_BYTES / "maxNurseryBytes" | Maximum size the nursery may grow to, or 0 to disable generational GC. |
JSGC_MIN_NURSERY_BYTES / "minNurseryBytes" | Minimum size the nursery may shrink to. |
JSGC_BYTES / "gcBytes" | Amount of bytes allocated by the GC. |
JSGC_NUMBER / "gcNumber" | Number of times GC has been invoked. Includes both major and minor GC. |
JSGC_MODE / "mode" | Select GC mode:
This does not affect generational GC, see |
JSGC_UNUSED_CHUNKS / "unusedChunks" | Number of cached empty GC chunks. |
JSGC_TOTAL_CHUNKS / "totalChunks" | Total number of allocated GC chunks. |
JSGC_SLICE_TIME_BUDGET / "sliceTimeBudget" | Max milliseconds to spend in an incremental GC slice. 0 for infinite. |
JSGC_MARK_STACK_LIMIT / "markStackLimit" | Maximum size the GC mark stack can grow to (units: entries). |
JSGC_HIGH_FREQUENCY_TIME_LIMIT / "highFrequencyTimeLimit" | GCs less than this far apart in time will be considered 'high-frequency GCs'. |
JSGC_HIGH_FREQUENCY_LOW_LIMIT / "highFrequencyLowLimit" | Controls for dynamic heap growth. When the GC is in "high frequency" mode (see above) then, the heap will be allowed to grow between collections according to these four parameters. See ZoneHeapThreshold::computeZoneHeapGrowthFactorForHeapSize in GC.cpp for the details. The first two parameters are in MB and the remaining two are in percentage of heap size. |
JSGC_HIGH_FREQUENCY_HIGH_LIMIT / "highFrequencyHighLimit" | |
JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MAX / "highFrequencyHeapGrowthMax" | |
JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MIN / "highFrequencyHeapGrowthMin" | |
JSGC_LOW_FREQUENCY_HEAP_GROWTH / "lowFrequencyHeapGrowth" | Heap growth percentage for low frequency GCs. |
JSGC_DYNAMIC_HEAP_GROWTH / "dynamicHeapGrowth" | If false, the heap growth percentage is fixed at 300%. If true, it is determined based on whether GCs are high- or low- frequency. |
JSGC_DYNAMIC_MARK_SLICE / "dynamicMarkSlice" | If true, high-frequency GCs will use a longer mark slice. |
JSGC_ALLOCATION_THRESHOLD / "allocationThreshold" | Lower limit after which we limit the heap growth. The heap will be collected if it is greater than: MAX(allocThreshold, lastSize) * thresholdFactor , This establishes allocThreshold as a baseline or default heap size. |
JSGC_ALLOCATION_THRESHOLD_FACTOR / "allocationThresholdFactor" | These thresholds (as percentages) are compared with the zone threshold (above) to decide when to begin an incremental collection. Additionally if a zone expands beyond the threshold without this factor, then it will be collected non-incrementally |
JSGC_ALLOCATION_THRESHOLD_FACTOR_AVOID_INTERRUPT / "allocationThresholdfactorAvoidInterrupt" | |
JSGC_MIN_EMPTY_CHUNK_COUNT / "minEmptyChunkCount" | We try to keep at least this many unused chunks in the free chunk pool at all times, even after a shrinking GC. |
JSGC_MAX_EMPTY_CHUNK_COUNT / "maxEmptyChunkCount" | We never keep more than this many unused chunks in the free chunk pool. |
JSGC_COMPACTION_ENABLED / "compactingEnabled" | non-zero to enable compacting, zero to disable. |
JSGC_NURSERY_FREE_THRESHOLD_FOR_IDLE_COLLECTION / "nurseryFreeThresholdForIdleCollection" | Collect the nursery in idle time if it has less than this many bytes of free space. |
JSGC_NURSERY_FREE_THRESHOLD_FOR_IDLE_COLLECTION_PERCENT / "nurseryFreeThresholdForIdleCollectionPercent" | Collect the nursery in idle time if it has less than this percentage of capacity free (value from 0 - 99). |
JSGC_PRETENURE_THRESHOLD / "pretenureThreshold" | If this percentage of the nursery is tenured and the nursery is at least 4MB, then process object groups to look for pretenuring candidates. |
JSGC_PRETENURE_GROUP_THRESHOLD / "pretenureGroupThreshold" | If more than this number of objects in a given object group are tenured, then pretenruing will be enabled for new objects in this group. |
JSGC_MIN_LAST_DITCH_GC_PERIOD / "minLastDitchGCPeriod" | The minimum time to allow between triggering last ditch GCs in seconds. |
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
- MXR ID Search for
JS_GetGCParameter
- MXR ID Search for
JS_SetGCParameter
- bug 474801
JSGC_BYTES
JSGC_NUMBER
- bug 474497
JSGC_MAX_CODE_CACHE_BYTES
- This option no-longer exists
JS_GetGCParameterForThread
JS_SetGCParameterForThread
- bug 624229
JSGC_MODE
- bug 631733
JSGC_UNUSED_CHUNKS
- bug 674480
JSGC_TOTAL_CHUNKS
- bug 641025
JSGC_SLICE_TIME_BUDGET
- bug 673551
JSGC_MARK_STACK_LIMIT
- bug 765435
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
- bug 800063
JSGC_ALLOCATION_THRESHOLD
- bug 871005
JSGC_DECOMMIT_THRESHOLD
- This option is no-longer exists
- bug 1017141
JSGC_MIN_EMPTY_CHUNK_COUNT
JSGC_MAX_EMPTY_CHUNK_COUNT
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论