benilla-re systems structs docs

StormHeapFree

function · storm · boundary

Address
0x645eb0 · 442 bytes, up to 0x646069
Signature
void __thiscall (void *this, void *header)
Meaning
Returns a block to its class: merges free buddies upward, queues it by address and decommits freed pages
Confidence
verified, proof one
Finding
storm/heap#merging-a-freed-block

Finding: Merging a freed block in storm: heap

0x645eb0 subtracts the block from the heap's counters. A block above class 24 is released whole. Otherwise, from its class up to 23, it finds the buddy header (the segment offset exclusive-ored with the class size). A buddy of the same class and not in use leaves its array and joins: the parent header is the offset rounded down to twice the class size, and when the joined halves are of class 12 or more the first page of the upper half is decommitted (a join of two class-11 halves decommits nothing). The first buddy that is in use or of another class ends the loop, and the block is queued.

The derivation is in the doc.

Callers 1

Callees 7

Calls and jumps by a bare address, from tables/calls.tsv.