pub unsafe extern "C" fn canonical_abi_realloc(
    original_ptr: *mut u8,
    original_size: usize,
    alignment: usize,
    new_size: usize
) -> *mut c_void
Expand description

Allocates memory in instance.

  1. Allocate memory of new_size with alignment.
  2. If original_ptr != 0.
    a. copy min(new_size, original_size) bytes from original_ptr to new memory.
    b. de-allocate original_ptr.
  3. Return new memory ptr.

§Safety

  • original_ptr must be 0 or a valid pointer.
  • If original_ptr is not 0, it must be valid for reads of original_size bytes.
  • If original_ptr is not 0, it must be properly aligned.
  • If original_size is not 0, it must match the new_size value provided in the original canonical_abi_realloc call that returned original_ptr.