Function xila_memory_deallocate

Source
#[no_mangle]
pub extern "C" fn xila_memory_deallocate(pointer: *mut c_void)
Expand description

Deallocates a previously allocated memory block.

This function frees memory that was previously allocated using xila_memory_allocate or xila_memory_reallocate. It’s safe to call this function with a null pointer.

§Safety

  • The pointer must have been returned by a previous call to xila_memory_allocate or xila_memory_reallocate
  • The pointer must not be used after this function returns
  • Double-free is safe and will be ignored

§Parameters

  • Pointer - Pointer to the memory block to deallocate, or null

§Examples

void* ptr = xila_memory_allocate(NULL, 1024, 8, 0);
xila_memory_deallocate(ptr); // Free the memory
xila_memory_deallocate(NULL); // Safe - ignored