Function tikv_jemalloc_sys::rallocx
source · pub unsafe extern "C" fn rallocx(
ptr: *mut c_void,
size: size_t,
flags: c_int,
) -> *mut c_void
Expand description
Resizes the previously-allocated memory region referenced by ptr
to be
at least size
bytes.
Deallocates the old object pointed to by ptr
and returns a pointer to
a new object that has the size specified by size
. The contents of the
new object are the same as that of the old object prior to deallocation,
up to the lesser of the new and old sizes.
The the memory in the new object beyond the size of the old object is
obtained according to flags
(it might be uninitialized).
The returned pointer to a new object may have the same value as a
pointer to the old object, but rallocx
may move the memory
allocation, resulting in a different return value than ptr
.
§Errors
On success it returns a non-null pointer. A null pointer return value indicates that insufficient contiguous memory was available to service the allocation request. In this case, the old object is not deallocated, and its value is unchanged.
§Safety
The behavior is undefiend if:
size == 0
, orptr
does not match a pointer earlier returned by the memory allocation functions of this crate, or- the memory region referenced by
ptr
has been deallocated.