Function alloc
Source pub fn alloc(size: usize) -> Result<*mut u8, AllocationError>
Expand description
- A reasonably safe implementation of
alloc.
- Memory allocated by this function must be freed by this crate’s
free.
- Caller guarantees
free is called before the returned pointer goes out of scope.
§Errors
Err(ArithmeticError) is returned on integer overflow, which shouldn’t happen.
Err(LayoutError) is returned if sizeof(([u8; 8], usize)) isn’t a power of 2.
Err(OutOfMemory) is returned if alloc() returned a nullptr.