WebAssembly linear memory

ID: webassembly-linear-memory

WebAssembly linear memory is an indexed sequence of bytes accessed by WebAssembly memory instructions. Its runtime representation records its type and current byte sequence. The length is a multiple of the WebAssembly page size, bytes, or . Declared limits give an initial minimum and optionally a maximum size in pages.[ref]
A load must fit its entire access into the current WebAssembly linear memory. For an instruction offset of zero, a four-byte i32.load in a one-page memory succeeds at address : its last accessed byte has address . At address , it would need a byte at address and therefore traps. In general, effective address and width must satisfy , where is the current length; the check includes the instruction's immediate offset.[ref]
This boundary example also distinguishes alignment from bounds. Ordinary unaligned loads are permitted; their alignment annotation is an optimization hint. A successful bounds check establishes that the accessed bytes lie inside this memory. It does not establish that the program selected its intended object.[ref]

New to topics? Read the docs here!