embedded-alloc
A heap allocator for embedded systems.
Note that using this as your global allocator requires Rust 1.68 or later.
(With earlier versions, you need the unstable feature #![feature(default_alloc_error_handler)]
)
This project is developed and maintained by the libs team.
Example
Starting with Rust 1.68, this crate can be used as a global allocator on stable Rust:
extern crate alloc;
use entry;
use Heap;
static HEAP: Heap = empty;
!
For a full usage example, see examples/global_alloc.rs
.
For this to work, an implementation of critical-section
must be provided.
For simple use cases you may enable the critical-section-single-core
feature in the cortex-m crate.
Please refer to the documentation of critical-section
for further guidance.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Code of Conduct
Contribution to this crate is organized under the terms of the Rust Code of Conduct, the maintainer of this crate, the libs team, promises to intervene to uphold that code of conduct.