WebAssembly and Web APIs that heavily use buffers (e.g., WebGPU, WebAudio) benefit from having more expressive buffers in addition to the current fixed-size ArrayBuffer
and SharedArrayBuffer
.
This proposal introduces two new buffer objects, as well as an extension to TypedArrays that lets the programmer create views that track the length of their underlying buffers.
WebAssembly's JS integration would then expose a ResizableArrayBuffer
or a GrowableSharedArrayBuffer
to avoid having to update all JS views when wasm memory grows.
APIs like WebGPU that wish to re-point ArrayBuffer
s can vend ResizableArrayBuffer
s instead, and can explain re-pointing under the hood as an atomic resizing + overwriting of contents.