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
reallochas.
Functions§
- needs_
padding - Whether a block of alignment
alignneeds padding. - offset
- How far into a padded block at address
rawthe pointer handed out is, for alignmentalign(a power of two aboveMIN_ALIGN). - padded_
size - The size to ask the SDK for, for
sizebytes aligned toalign(padded);Nonewhen that overflows.