Preventing memory fragmentation when streaming large WASM-allocated binary buffers via WebSockets in SharedArrayBuffers
I am building a high-throughput client-side application that processes real-time sensor telemetry using a C++ module compiled to WebAssembly. The data streams in via a WebSocket connection directly into a SharedArrayBuffer to avoid main-thread serialization overhead. The Problem: Because the incoming payload frequency fluctuates unpredictably (from 10 KB/s up to 50 MB/s bursts), frequent reallocations and resizing of the linear memory inside the WASM heap cause severe memory fragmentation. Even after calling explicit cleanup routines in C++, the browser's JavaScript engine (V8) does not releas
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.