Expand description
§Custom Allocator for HEAP memory allocations
This crate provides a custom allocator for heap memory. If any baremetal crate uses functions and structures from
the alloc
crate an allocator need to be provided as well. However, this crate does not export any public
API to be used. It only encapsulates the memeory allocator that shall be linked into the binary.
§Prerequisit
The lock free memory allocations use atomic operations. Thus to properly work on a Raspberry Pi the MMU is required to be configured and enabled. Otherwise memory allocations will just hang the cores.
§Usage
To link the custom allocator with your project just add the usage to your main crate rust file like so:
extern crate ruspiro_allocator;
Wherever you define the usage of the ruspiro-allocator
crate within your project does not matter. But as soon
as this is done the dynamic structures requiring heap memory allocations from the alloc
crate could be used like
so:
#[macro_use]
extern crate alloc;
use alloc::{boxed::Box, vec::Vec};
fn main() {
let mut v: Vec<u32> = vec![10, 20];
let b: Box<u16> = Box::new(10);
v.push(12);
}