Skip to main content

Module heap

Module heap 

Source
Expand description

The arithmetic of the allocator over the SDK’s realloc (crate::device).

The SDK’s realloc returns blocks aligned to MIN_ALIGN bytes. A bigger alignment gets a block padded_size long; the pointer handed out is offset bytes into it, and the block’s own address is kept in the word just before that pointer, so freeing finds it again.

Constants§

MIN_ALIGN
The alignment every block from the SDK’s realloc has.

Functions§

needs_padding
Whether a block of alignment align needs padding.
offset
How far into a padded block at address raw the pointer handed out is, for alignment align (a power of two above MIN_ALIGN).
padded_size
The size to ask the SDK for, for size bytes aligned to align (padded); None when that overflows.