Expand description
ArceOS global memory allocator.
It provides GlobalAllocator, which implements the trait
core::alloc::GlobalAlloc. A static global variable of type
GlobalAllocator is defined with the #[global_allocator] attribute, to
be registered as the standard library’s default allocator.
Modules§
- tracking
- Tracking of memory usage, enabled with the
trackingfeature.
Structs§
- Global
Allocator - The global allocator used by ArceOS when TLSF is enabled.
- Global
Page - A RAII wrapper of contiguous 4K-sized pages.
- Usages
- Statistics of memory usages.
Enums§
- Alloc
Error - The error type used for allocation operations in
ax-alloc. - Usage
Kind - Kinds of memory usage for tracking.
Traits§
- Allocator
Ops - Unified allocator operations provided by all
ax-allocbackends.
Functions§
- global_
add_ memory - Add the given memory region to the global allocator.
- global_
allocator - Returns the reference to the global allocator.
- global_
init - Initializes the global allocator with the given memory region.
- init_
percpu_ slab - Initializes per-CPU allocator state.
- register_
page_ reclaim_ fn - Register a callback that the allocator will invoke when a page allocation cannot be satisfied.
- try_
page_ reclaim - Try to reclaim physical pages by invoking the registered callback. Returns the number of pages actually freed.
Type Aliases§
- Alloc
Result - A
Resultalias withAllocErroras the error type. - Default
Byte Allocator - The default byte allocator for TLSF mode.
- Page
Reclaim Fn - A function that tries to reclaim physical pages (e.g. by evicting clean file-backed page cache pages). Returns the number of pages freed.