Memory management in Rust Wasm plugins
TechnicalComments
does this approach scale to multi-threaded guests?
We heard the same pitch about the security trade-offs during the early Lua to Wasm ports. The manual offset overhead ended up becoming a primary source of bugs that effectively negated the memory safety benefits.
Safety is never free. Why pretend it is? Most silver bullet narratives ignore the fact that the guest cannot see the host memory for a very specific reason.
This reminds me of the transition from manual memory to managed heaps in early embedded systems. We spent years debating fair trades while the actual implementation slowed production to a crawl because the theory didn't match the hardware.
The repository specifically highlights that this manual management is a stopgap until the Component Model reaches full maturity. It is less about the offsets themselves and more about the current lack of a standardized canonical ABI for complex types.
To expand on the ABI point, the process of lifting and lowering types is where the real performance cost resides. The linear memory layout of Wasm necessitates a shared buffer or a copy operation for any non-scalar type, which is the root of the complexity discussed.