Crate umm_malloc

source ·
Expand description

Provides a global allocator using the umm_malloc library. You must call umm_malloc::init_heap() exactly once before allocating anything using the global memory allocator.

All allocations from this allocator are aligned by 8 bytes. Requesting a larger alignment is not implemented and will panic.

Global Allocator Critical Sections

Concurrent access to the global allocator is Undefined Behavior. Enable only one of the following cargo features to configure how access to the global allocator is controlled.

  • cortex-m-interrupt-critical-section: interrupt-disabled critical section for ARM Cortex-M processors.
  • extern-critical-section: Uses the extern functions void _umm_critical_entry(uint32_t*) and void _umm_critical_exit(uint32_t*) to implement the global allocator critical sections. You MUST supply those functions via some other means. Note that critical sections may nest.
  • unsafe-no-critical-section: no critical sections around the global allocator. You MUST prevent concurrent use of the global allcator to avoid Undefined Behavior.

Constants

All allocations from this allocator are aligned to MIN_ALIGN. Alignments larger than MIN_ALIGN are currently not supported. Calling alloc() or realloc() with a layout requesting a larger alignment will panic.

Functions

init
Initializes the heap from extern addresses
Initializes the heap with the given block of memory