Function jemalloc_sys::posix_memalign
source · pub unsafe extern "C" fn posix_memalign(
ptr: *mut *mut c_void,
alignment: size_t,
size: size_t
) -> c_int
Expand description
Allocates size
bytes of memory at an address which is a multiple of
alignment
and is placed in *ptr
.
If size
is zero, then the value placed in *ptr
is either null, or
the behavior is as if the size
were some nonzero value, except that
the returned pointer shall not be used to access an object.
Errors
On success, it returns zero. On error, the value of errno
is not set,
*ptr
is not modified, and the return values can be:
EINVAL
: thealignment
argument was not a power-of-two or was not a multiple ofmem::size_of::<*const c_void>()
.ENOMEM
: there was insufficient memory to fulfill the allocation request.
Safety
The behavior is undefined if:
ptr
is null.