pub unsafe fn twz_rt_realloc(
ptr: *mut u8,
layout: Layout,
new_size: usize,
flags: AllocFlags,
) -> Option<*mut u8>
Expand description
Reallocate runtime memory pointed to by ptr, with a given layout and flags, to new_size. The new size can be larger or smaller than the original, and may move while maintaining layout constraints. If the allocation moves, the old memory will be copied over and automatically freed.
§Safety
Caller must ensure that any no other references to this memory are alive.
§Flags
- ZERO_MEMORY: If the allocation size grows, zero the newly-allocated memory before returning it to the user. If the allocation size shrinks, zero the old, now unused, part of the memory before freeing. If the allocation moves, zero the old allocation before freeing.