Function rbot::alloc_wasm
source · #[no_mangle]
pub extern "C" fn alloc_wasm(size: i32) -> i32Expand description
Allocates a memory buffer in the robot’s sandbox environment for storing data from the host environment.
This function provides an interface for the host environment to allocate a memory buffer within the robot’s sandbox environment. The allocated buffer is initialized with zeros and can be used to store data passed from the host environment to the robot’s runtime.
§Safety
This function is marked as unsafe because it involves direct manipulation
of memory pointers and relies on external interactions with the robot’s
sandbox environment.
§Arguments
size- The size of the memory buffer to allocate in bytes.
§Returns
An integer representing the pointer to the allocated memory buffer within the robot’s sandbox environment.