Click or drag to resize

V8ScriptEngineMaxRuntimeHeapSize Property

Gets or sets a soft limit for the size of the V8 runtime's heap.

Namespace: Microsoft.ClearScript.V8
Assembly: ClearScript.V8 (in ClearScript.V8.dll) Version: 7.4.5
Syntax
public UIntPtr MaxRuntimeHeapSize { get; set; }

Property Value

UIntPtr
Remarks

This property is specified in bytes. When it is set to the default value, heap size monitoring is disabled, and scripts with memory leaks or excessive memory usage can cause unrecoverable errors and process termination.

A V8 runtime unconditionally terminates the process when it exceeds its resource constraints (see V8RuntimeConstraints). This property enables external heap size monitoring that can prevent termination in some scenarios. To be effective, it should be set to a value that is significantly lower than MaxOldSpaceSize. Note that enabling heap size monitoring results in slower script execution.

Exceeding this limit causes the V8 runtime to behave in accordance with RuntimeHeapSizeViolationPolicy.

Note that ArrayBuffer memory is allocated outside the runtime's heap and is therefore not tracked by heap size monitoring. See MaxArrayBufferAllocation for additional information.

See Also