Function javy::alloc::canonical_abi_realloc
source · 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.
- Allocate memory of new_size with alignment.
- If original_ptr != 0.
a. copy min(new_size, original_size) bytes from original_ptr to new memory.
b. de-allocate original_ptr. - 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 oforiginal_size
bytes. - If
original_ptr
is not 0, it must be properly aligned. - If
original_size
is not 0, it must match thenew_size
value provided in the originalcanonical_abi_realloc
call that returnedoriginal_ptr
.