10 releases

✓ Uses Rust 2018 edition

0.2.1 Jan 17, 2020
0.2.0 Jan 17, 2020
0.1.2 Oct 14, 2019
0.1.1 Sep 2, 2019
0.0.7 Jul 30, 2019
Download history 15/week @ 2020-02-08 6/week @ 2020-02-15 128/week @ 2020-02-22 5/week @ 2020-02-29 44/week @ 2020-03-07 16/week @ 2020-03-14 65/week @ 2020-03-21 13/week @ 2020-03-28 29/week @ 2020-04-04 78/week @ 2020-04-11 84/week @ 2020-04-18 14/week @ 2020-04-25 11/week @ 2020-05-02 70/week @ 2020-05-09 41/week @ 2020-05-16 89/week @ 2020-05-23

139 downloads per month
Used in iso7816-tlv

MIT license

494 lines


Crates.io Status Docs.rs Status License CI Status

General purpose global allocator(s) with static, inline storage.

Goal and Target Platform

Provides an allocator for extremely resource constrained environments where the only memory guaranteed is your program's image in memory as provided by the loader. Possible use cases are OS-less development, embedded, bootloaders (even stage0/1 maybe, totally untested).

Possible use cases are OS-less development, embedded, bootloaders (even stage0/1 maybe, totally untested). The primary goals are similar to the standard library simplicity, and correctness, and minimal assumptions.


As a global allocator for alloc with some safe allocation extensions:

use static_alloc::Bump;

static A: Bump<[u8; 1 << 16]> = Bump::uninit();

fn main() {
    // Vec occupying `1 << 7` bytes
    let v = vec![0xdeadbeef_u32; 32];

    // … or allocate values directly.
    let buffer: &mut [u32; 32] = A.leak([0; 32])

You can also use it as a local allocator creating dynamic values on the stack. In this case you might want to be more conservative with resource usage so as not to blow the stack. The benefit is even larger using it together with without-alloc which provides high-level data structures that you are used to from alloc.

use static_alloc::Bump;

fn main() {
    for _ in 0..100 {
        let local: Bump<[u8; 32]> = Bump::uninit();
        let temp_buffer = local.leak([0; 32]);
	// Resources are cleaned up.


PRs introducing more tests or documentation are very welcome! Whatever else submitted should have simplicity and composability in mind, ideas that can not be put into a draft form are likely too complex or not focussed enough. PRs should be extremely reluctant with introducing new dependencies and should contain no non-optional dependency.

Please open issues with drafts only, feature requests and 'help' issues will be closed (if you are lucky with a final comment). Stability trumps growth. I simply can not make any longterm commitment outside my intrinsic motiviation towards this project. Hence, I favour a highly usable core over a large interface that is only somewhat usable.


This project is mainly MIT licensed. You may alternatively choose the Unlicense instead in which case the copyright headers signify the parts dedicated to the public domain to the fullest possible extent instead.