WasmtimeRuntimeOptions Class

Options of a WasmtimeRuntime.

public sealed class WasmtimeRuntimeOptions

Constructors

NameDescription
WasmtimeRuntimeOptions()

WasmtimeRuntimeOptions()

WasmtimeRuntimeOptions.cs
public WasmtimeRuntimeOptions()

No documentation is available.

Properties

NameDescription
InterruptionCheckIntervalGets the interval at which the running WebAssembly code checks whether it must be interrupted (e.g. the timeout of the script engine). The default is 10 milliseconds.
MaxMemorySizeGets the maximum size of a memory, in bytes. The default and the upper limit is the maximum length of a .NET array (the memories are .NET arrays, so that the ArrayBuffer objects of JavaScript share their bytes): a memory that would be larger cannot grow. The bytes of a shared memory are allocated for its maximum size, limited by this value: a shared memory cannot grow beyond.
MaxStackSizeGets the maximum size of the stack of the WebAssembly code, in bytes. The default is 512 KiB. A deeper recursion throws the exception of a stack overflow of JavaScript (a RangeError).
ModuleCacheDirectoryGets the folder where the compiled code of the modules is saved, to be loaded instead of compiled again when the same module is compiled later, by this runtime or by another one (another test, another run of the tests). The default is null: the modules are compiled each time. Compiling a large module, such as the runtime of .NET in a Blazor WebAssembly application, takes seconds, while loading it from the folder takes milliseconds.

InterruptionCheckInterval

WasmtimeRuntimeOptions.cs

Gets the interval at which the running WebAssembly code checks whether it must be interrupted (e.g. the timeout of the script engine). The default is 10 milliseconds.

public TimeSpan InterruptionCheckInterval { get; init; }

Property value

TimeSpan

Gets the maximum size of a memory, in bytes. The default and the upper limit is the maximum length of a .NET array (the memories are .NET arrays, so that the ArrayBuffer objects of JavaScript share their bytes): a memory that would be larger cannot grow. The bytes of a shared memory are allocated for its maximum size, limited by this value: a shared memory cannot grow beyond.

public long MaxMemorySize { get; init; }

Property value

long

Gets the maximum size of the stack of the WebAssembly code, in bytes. The default is 512 KiB. A deeper recursion throws the exception of a stack overflow of JavaScript (a RangeError).

public int MaxStackSize { get; init; }

Property value

int

ModuleCacheDirectory

WasmtimeRuntimeOptions.cs

Gets the folder where the compiled code of the modules is saved, to be loaded instead of compiled again when the same module is compiled later, by this runtime or by another one (another test, another run of the tests). The default is null: the modules are compiled each time. Compiling a large module, such as the runtime of .NET in a Blazor WebAssembly application, takes seconds, while loading it from the folder takes milliseconds.

public string? ModuleCacheDirectory { get; init; }

Property value

string?

Remarks

The files are native code that the runtime loads and runs without validating it: use a folder that only the current user can write to. A file that does not match the version or the configuration of Wasmtime is replaced. The files are never deleted: they are about ten times as large as the modules.