Function esp_idf_svc::sys::heap_caps_realloc
source · pub unsafe extern "C" fn heap_caps_realloc(
ptr: *mut c_void,
size: usize,
caps: u32,
) -> *mut c_void
Expand description
@brief Reallocate memory previously allocated via heap_caps_malloc() or heap_caps_realloc().
Equivalent semantics to libc realloc(), for capability-aware memory.
In IDF, realloc(p, s)
is equivalent to heap_caps_realloc(p, s, MALLOC_CAP_8BIT)
.
‘caps’ parameter can be different to the capabilities that any original ‘ptr’ was allocated with. In this way, realloc can be used to “move” a buffer if necessary to ensure it meets a new set of capabilities.
@param ptr Pointer to previously allocated memory, or NULL for a new allocation. @param size Size of the new buffer requested, or 0 to free the buffer. @param caps Bitwise OR of MALLOC_CAP_* flags indicating the type of memory desired for the new allocation.
@return Pointer to a new buffer of size ‘size’ with capabilities ‘caps’, or NULL if allocation failed.