kernel-alloc-rs
Why?
Rust has many useful abstractions and utils that require heap allocations. String
, Vec
and Box
are some of them. To be able to use them, we need to allocate memory at runtime, which requires a custom allocator.
If you want to find out more about it, please refer to the alloc::GlobalAllocator and the Rust book.
Example
Add the following to your code to define new global allocator:
use KernelAlloc;
static GLOBAL: KernelAlloc = KernelAlloc;