rust-osdev / linked-list-allocator

Apache License 2.0
219 stars 53 forks source link

add an initialize method to Heap #2

Closed japaric closed 7 years ago

japaric commented 7 years ago

this lets you create an allocator that doesn't depend on lazy_init. Example below:

static HEAP: Mutex<Heap> = Mutex::new(Heap::new());

unsafe fn before_main() {
    HEAP.lock().init(BOTTOM, SIZE);
}

fn main() {
    // Use the allocator
}
phil-opp commented 7 years ago

Thanks!