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.
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)
(and note that this is all configurable, so 8G is just the default)
Last updated: Dec 23 2024 at 13:07 UTC