Module heap
Global Freestanding Heap Unified heap interface backed by:
Freestanding: static HEAP_SIZE-byte buffer managed by TLSF (O(1), real-time-safe).
Hosted: thin malloc/free/realloc wrappers.
Override buffer size with -DHEAP_SIZE=<bytes> at compile time.
Functions
| heap_init | no-op |
| heap_alloc | Allocate size bytes from the global heap. Returns NULL on failure. |
| heap_free | Free a block returned by heap_alloc() or heap_realloc(). |
| heap_realloc | Resize an allocation. Copies up to min(old_size, new_size) bytes. Returns NULL on failure; original block is NOT freed in that case. |
| heap_capacity | Return total heap capacity in bytes. In hosted mode returns 0 (unbounded). |
Macros
| HEAP_SIZE | 1 MiB default |