Skip to main content

guest_alloc

Function guest_alloc 

Source
pub fn guest_alloc(size: i32) -> i32
Expand description

Guest memory allocator the host calls (via the alloc export generated by crate::export_alloc!) to write return values into the WASM linear memory. Hands out 8-byte aligned slices from the bump arena.

Returns 0 on failure (size not positive, arena exhausted) - the host treats 0 as “guest cannot accept this value” and propagates an error.