Stream: wasmtime

Topic: Required virtual space for static memory allocation


view this post on Zulip Marcel Stolin (Nov 01 2024 at 14:45):

The documentation defines two guard regions around a linear memory instance. A preceding guard region, to mitigate sign-extension bugs, and an optional subsequent guard region for JIT optimization.
Further, if i define a statically allocated linear memory instance, Wasmtime reserves 4GB (the Wasm max) of virtual space for it (i'm on a 64bit machine). Lets assume both guard regions have the default size of 2GB.

For my understanding, this would mean that Wasmtime reserves 8GB of virtual memory for a single instance of a linear memory?
On https://docs.rs/wasmtime/latest/wasmtime/struct.Config.html#method.static_memory_maximum_size, it states that Wasmtime requires 6GB of memory for static allocation.

view this post on Zulip Alex Crichton (Nov 01 2024 at 14:49):

You're correct that 8GB would be necessary, and the docs there are referring to the linear memory itself + the trailing guard region (we should probably update the docs to mention the preceding guard region too)

view this post on Zulip Alex Crichton (Nov 01 2024 at 14:50):

(and note that this is all configurable, so 8G is just the default)


Last updated: Nov 22 2024 at 16:03 UTC