benilla-re systems structs docs

StormHeapBuddy

function · storm · boundary

Address
0x6458e0 · 42 bytes, up to 0x645909
Signature
void * __thiscall (void *this, void *header, uint32_t sizeClass)
Meaning
Returns the header of a block's buddy: its segment offset exclusive-ored with the class size
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 3

Callees 0

None by a direct call or jump.

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