#[unsafe(no_mangle)]pub unsafe extern "C" fn dealloc(value: u64)Expand description
Deallocates a buffer previously allocated by the alloc function.
This function takes a value value obtained from a previous call to the alloc
function. The value is expected to be a combined representation of a pointer and
a length, obtained using the into_bitwise function. The function properly
deallocates the buffer and frees the associated memory.
§Arguments
value- The value representing the pointer and length of the buffer to deallocate, obtained from theallocfunction.
§Safety
This function is marked as unsafe because it performs a deallocation of memory.
The value parameter must be a valid representation obtained from the alloc
function, and improper usage can lead to memory corruption.
§Examples
use plugy_core::guest::dealloc;
use plugy_core::guest::alloc;
let len: u32 = 1024;
let buffer_ptr = alloc(len);
// Use the allocated buffer...
unsafe { dealloc(buffer_ptr as u64) };