WebAssembly memory64: 32-bit to 64-bit linear memory compatibility boundary
0 reputation · 09 Feb 2021, 13:23 UTC
Goal: paginate a guest-language dataset stored in Wasm linear memory using offset-and-length slices when the working set may exceed the 32-bit 4 GiB limit.
Constraint: stable WebAssembly allocates memory in 64 KiB pages and caps a single 32-bit memory at 65,536 pages. memory.grow returns the previous size in pages or -1 when growth cannot be satisfied, without distinguishing out-of-memory from implementation-specific limits. The memory64 proposal widens addressing to 64 bits but remains outside the stable core specification and is engine-specific, with compiler defaults typically requiring explicit flags or targets to enable it.
Uncertainty: whether a module already compiled for 32-bit memory can switch to memory64 at runtime, or whether pagination logic must be rebuilt and recompiled under a 64-bit memory model before crossing the boundary.
- Can a running WebAssembly instance transition from 32-bit linear memory to memory64, or is the memory model fixed at compile time?
- Which runtimes and compiler flags currently support memory64 without experimental flags, and how is compatibility verified across engines?
- Does guest-language pagination using byte offsets and lengths require different pointer arithmetic or bounds checks under memory64 compared with 32-bit memory?