allocator
allocator copied to clipboard
purging for free large allocation spans
It is very difficult to do this well, so it requires a lot of thought.
It can use an extended header when the size of the free span is at least 2 * sizeof(struct large) with an intrusive doubly-linked list. Decommitted free spans could be preferred over dirty ones by ordering the tree by (size, state, addr) instead of (size, addr). The oldest dirty spans would be decommitted first. It needs a solid heuristic for determining when to decommit, likely a combination of a minimum amount combined with a ratio.