remap property
Attempt to expand or shrink memory, allowing relocation.
memory_len must equal the length requested from the most recent
successful call to alloc, resize, or remap. alignment must
equal the same value that was passed as the alignment parameter to
the original alloc call.
A non-NULL return value indicates the resize was successful. The
allocation may have same address, or may have been relocated. In either
case, the allocation now has size of new_len. A NULL return value
indicates that the resize would be equivalent to allocating new memory,
copying the bytes from the old memory, and then freeing the old memory.
In such case, it is more efficient for the caller to perform the copy.
new_len must be greater than zero.
@param ctx The allocator context @param memory Pointer to the memory block to remap @param memory_len Current size of the memory block @param alignment Alignment (must match original allocation) @param new_len New requested size @param ret_addr First return address of the allocation call stack (0 if not provided) @return Pointer to resized memory (may be relocated), or NULL if manual copy is needed
Implementation
external ffi.Pointer<
ffi.NativeFunction<
ffi.Pointer<ffi.Void> Function(
ffi.Pointer<ffi.Void> ctx,
ffi.Pointer<ffi.Void> memory,
ffi.Size memory_len,
ffi.Uint8 alignment,
ffi.Size new_len,
ffi.UintPtr ret_addr,
)
>
>
remap;