Skip to content

Slab allocator for no_std systems. Uses multiple slabs with blocks of different sizes and makes a linked list from free blocks

License

Notifications You must be signed in to change notification settings

weclaw1/slab_allocator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

slab_allocator

Build Status

Documentation

Usage

Create a static allocator in your root module:

use slab_allocator::LockedHeap;

#[global_allocator]
static ALLOCATOR: LockedHeap = LockedHeap::empty();

Before using this allocator, you need to init it:

pub fn init_heap() {
    let heap_start = …;
    let heap_end = …;
    let heap_size = heap_end - heap_start;
    unsafe {
        ALLOCATOR.init(heap_start, heap_size);
    }
}

License

This crate is licensed under MIT. See LICENSE for details.

About

Slab allocator for no_std systems. Uses multiple slabs with blocks of different sizes and makes a linked list from free blocks

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages