#allocator #no_std #malloc #heap #kernel

nightly no-std linked_list_allocator

Simple allocator usable for no_std systems. It builds a linked list from the freed blocks and thus needs no additional data structures.

22 releases

0.6.3 Jul 9, 2018
0.6.1 Apr 27, 2018
0.5.0 Jan 24, 2018
0.4.3 Dec 15, 2017
0.1.2 Mar 5, 2016

#7 in Memory management

Download history 296/week @ 2018-08-07 186/week @ 2018-08-14 298/week @ 2018-08-21 295/week @ 2018-08-28 174/week @ 2018-09-04 107/week @ 2018-09-11 104/week @ 2018-09-18 75/week @ 2018-09-25 184/week @ 2018-10-02 81/week @ 2018-10-09 71/week @ 2018-10-16 104/week @ 2018-10-23 41/week @ 2018-10-30

860 downloads per month
Used in 5 crates (4 directly)

Apache-2.0/MIT

31KB
558 lines

linked-list-allocator

Build Status

Documentation

Usage

Create a static allocator in your root module:

use linked_list_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.lock().init(heap_start, heap_size);
    }
}

License

This crate is dual-licensed under MIT or the Apache License (Version 2.0). See LICENSE-APACHE and LICENSE-MIT for details.

Dependencies

  • use_spin spin 0.4.5