arceos_api::mem

Function ax_alloc

Source
pub unsafe fn ax_alloc(layout: Layout) -> Option<NonNull<u8>>
Available on crate feature alloc only.
Expand description

Allocates a continuous memory blocks with the given layout in the global allocator.

Returns None if the allocation fails.

ยงSafety

This function is unsafe because it requires users to manually manage the buffer life cycle.