Module alloc

Source
Expand description

TODO: document alloc module.

Re-exports§

pub use self::layout::Layout;

Modules§

heap
A simple heap based on a buddy allocator. For the theory of buddy allocators, see https://en.wikipedia.org/wiki/Buddy_memory_allocation or https://www.memorymanagement.org/mmref/alloc.html#buddy-system
layout
Implements a simple memory layout structure.
paging
Implements two memory allocators: a Buddy Allocator and a Best-Fit Allocator, respectively referred to as [BUDDY_ALLOCATOR][crate::alloc::paging::BUDDY_ALLOCATOR] and [FIT_ALLOCATOR][crate::alloc::paging::FIT_ALLOCATOR].

Structs§

AllocationError
GlobalAllocator
A global allocator for our program.
LockedAllocator
A simple wrapper around spin::Mutex to enable trait implementations.

Statics§

GLOBAL

Traits§

Allocator

Functions§

__rust_allocate
Allocates a chunk of memory.
__rust_deallocate
Frees a chunk of memory.
__rust_reallocate
Reallocates a chunk of memory.
__rust_reallocate_inplace
We do not support in-place reallocation, so just return oldSize.
__rust_usable_size
I have no idea what this actually does, but we’re supposed to have one, and the other backends to implement it as something equivalent to the following.
allocate
Performs a single heap allocation, like malloc. Uses the size and align of T for the memory layout.
allocate_array
Allocates an array of size size.