Skip to main content

init

Function init 

Source
pub unsafe fn init()
Expand description

Initializes the heap from extern addresses

This function initializes the heap using the address defined by the extern pointer UMM_MALLOC_CFG_HEAP_ADDR with size defined by the extern u32 UMM_MALLOC_CFG_HEAP_ADDR. You must define symbols with those (unmangled) names elsewhere, e.g. in your linker script.

See umm_malloc::init_heap() for runtime initialization.

§Note

  • The heap grows “upwards”, towards larger addresses. Thus end_addr must be larger than start_addr.
  • The size of the heap is (end_addr as usize) - (start_addr as usize). The allocator won’t use the byte at end_addr.

§Safety

Obey these or Bad Stuff will happen.

  • This function must be called exactly ONCE.
  • This function must be called BEFORE you run any code that makes use of the allocator unless the cargo feature init-if-uninitialized or hang-if-uninitialized is enabled.