Function jemalloc_sys::malloc

source ·
pub unsafe extern "C" fn malloc(size: size_t) -> *mut c_void
Expand description

Allocates size bytes of uninitialized memory.

It returns a pointer to the start (lowest byte address) of the allocated space. This pointer is suitably aligned so that it may be assigned to a pointer to any type of object and then used to access such an object in the space allocated until the space is explicitly deallocated. Each yielded pointer points to an object disjoint from any other object.

If the size of the space requested is zero, either a null pointer is returned, 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

If the space cannot be allocated, a null pointer is returned and errno is set to ENOMEM.