pub unsafe fn unwrapped_realloc(
p: *mut u8,
new_size: usize,
alignment: usize,
) -> *mut u8Expand description
Resize a pointer returned by unwrapped_malloc or unwrapped_realloc.
Thin wrapper around mi_unwrapped_realloc (include/mimalloc/memory-events.h).
If p is null, this behaves like unwrapped_malloc. If new_size is
0, this frees p (like unwrapped_free) and returns a null pointer.
Otherwise the existing contents are copied into a freshly allocated
unwrapped block (up to min(old payload size, new_size) bytes) and p is
freed; p must not be used again after this call, whether or not it
returns null.
Returns a null pointer on failure (including invalid alignment; see
unwrapped_malloc’s # Safety section), in which case p is left
valid and unfreed.
§Safety
pmust be either a null pointer or a pointer previously returned byunwrapped_mallocorunwrapped_reallocthat has not already been freed, per the same family-isolation rule asunwrapped_free.alignmenthas the same power-of-two-or-zero contract asunwrapped_malloc.- After this call,
pmust not be read, written, or freed again — treat it as consumed regardless of whether the return value is null.