Skip to main content

aligned_alloc

Function aligned_alloc 

pub unsafe extern "C" fn aligned_alloc(
    alignment: usize,
    size: usize,
) -> *mut c_void
Available on crate feature cli only.
Expand description

Allocates size bytes of memory at an address which is a multiple of alignment.

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

Returns null if the request fails.

§Safety

The behavior is undefined if:

  • alignment is not a power-of-two
  • size is not an integral multiple of alignment