Function alloc

Source
pub unsafe fn alloc(
    layout: Layout,
) -> Result<(NonNull<ScrapHeap>, NonNull<u8>), AllocError>
Expand description

Attempts to allocate memory using the thread-local scrap heap managed by the custom memory system.

§Errors

Returns a pair of non-null pointers to the scrap heap and the allocated memory on success, or an AllocError if allocation fails.

§Safety

  • The returned memory is uninitialized.
  • The caller must ensure proper usage and deallocation of the returned pointer.