#alloc #esp32 #esp

no-std esp-idf-alloc

An allocator for the ESP32 based on the ESP-IDF

2 releases

0.1.1 Jun 28, 2019
0.1.0 Jun 28, 2019

#421 in Memory management

43 downloads per month

EPL-2.0 license


Rust allocator backed by ESP-IDF

This is a memory allocator for Rust, backed by the ESP-IDF.

This is intended to be used on an ESP32, linked against the ESP-IDF. For more information see:


Add the following to your main, application project:

extern crate esp_idf_alloc;

static A: esp_idf_alloc::EspIdfAllocator = esp_idf_alloc::EspIdfAllocator;

Error handler

If you use a custom global allocator in your application, you will also need an error handler.

The following code will use the ESP-IDF abort() method to handle the error:


use core::alloc::Layout;

extern "C" {
    fn abort() -> !;

fn alloc_error(_layout: Layout) -> ! {
    unsafe {

Using with alloc

Also be sure to link in the alloc create, as you might want this. Add the following to your Xargo.toml:


No runtime deps