realloc

Function realloc 

Source
pub unsafe fn realloc(
    ptr: *mut u8,
    new_size: usize,
) -> Result<*mut u8, ReallocationError>
Expand description

Reallocates memory allocated by crate::alloc.

§Errors

  • AllocationError is returned if the call to crate::alloc fails.
  • DeallocationError is returned if the call to crate::free fails.
  • ImproperAlignment is returned if the pointer provided was not aligned properly.
  • MarkerFree is returned if ptr was previously freed or reallocated.
  • MarkerCorrupted is returned if the marker is neither free nor used, which generally signals memory corruption, or the passing of a pointer not allocated by crate::alloc.
  • NewAllocationFailed is returned if allocating the new memory buffer fails. This is the only error which is fully recoverable, as your current allocation remains valid.

§Safety

See crate::free for safety information.