Linear memory
WebAssembly linear memory is a byte-addressed buffer accessed from JavaScript through typed-array views. Its bounds are checked by the runtime.
What it is
WebAssembly linear memory is a byte-addressed buffer accessed from JavaScript through typed-array views. Its bounds are checked by the runtime.
Why it matters
Pointers are offsets into a shared buffer, not JavaScript objects. The host and module must agree on layout and ownership.
Example
A float32 vector of 25 elements occupies 100 bytes. A pointer must be aligned and leave that many bytes in bounds.
Technical detail
After memory growth, recreate JavaScript views as required by the memory type; old views must not be assumed valid.
When to use it
Use fixed buffers for small inference kernels and explicit bounds checks at the host boundary.
Go deeper
Sources
More in Web platform
Assembled from the ReLU.chat curated knowledge base. These explanations are concise on purpose; check the sources for anything important.