pub unsafe fn alloc(layout: Layout) -> *mut u8
Expand description
Allocate memory with the global allocator.
This is equivalent to the standard library’s std::alloc::alloc
, but with
the addition of leak tracking for allocated objects. Loom’s leak tracking
will not function for allocations not performed via this method.
This function forwards calls to the GlobalAlloc::alloc
method
of the allocator registered with the #[global_allocator]
attribute
if there is one, or the std
crate’s default.
§Safety
See GlobalAlloc::alloc
.