Skip to main content

c_alloc

Function c_alloc 

Source
pub fn c_alloc(align: usize, size: usize) -> *mut c_void
Expand description

Allocates size bytes with at least align alignment.

The closest Rust equivalent is alloc.

On non-Windows platforms this forwards to aligned_alloc, which requires align to be a power of two and a multiple of size_of::<*mut c_void>(), and size to be a multiple of align.

ยงReturns

  • On success returns a nonnull pointer to the allocated memory.
  • On allocation failure returns NULL.