Skip to main content

init_heap_sized

Macro init_heap_sized 

Source
macro_rules! init_heap_sized {
    (reclaimed: $reclaimed:expr, dram: $dram:expr) => { ... };
    (reclaimed: $reclaimed:expr) => { ... };
    (dram: $dram:expr) => { ... };
}
Expand description

Register the global heap’s DRAM regions at explicit sizes. Use when no HeapProfile fits — a binary whose sizes are tuned against its own workload rather than a shared one.

m5stack_core::init_heap_sized!(reclaimed: 56 * 1024);
m5stack_core::init_heap_sized!(reclaimed: 96 * 1024, dram: 24 * 1024);

A macro, not a function: heap_allocator! sizes a static, and a static cannot read a const generic of the function containing it. The size has to arrive as a literal at the expansion site.

Prefer init_heap: a profile is HIL-proven and shared, and a binary that picks its own number owns the consequences of getting it wrong. This is for the case where that number IS the validated result — e.g. an LVGL workload that OOMs mid-render at the Lvgl profile’s 50 K.

Same region budget as init_heap: esp-alloc holds at most three regions and psram_split wants one.