# _Z_Align4
inline function _Z_Align4(n)Rounds an allocation size upward to the allocator's four-byte boundary.
| Parameter | Type | Default | Description |
|---|---|---|---|
n | dynamic | — | Number of values to process. |
src/z_zone.mlImplements zone-style memory tagging and allocation lifecycle helpers.
doomdef.ml → src/doomdef.mli_system.ml → src/i_system.mlinline function _Z_Align4(n)Rounds an allocation size upward to the allocator's four-byte boundary.
| Parameter | Type | Default | Description |
|---|---|---|---|
n | dynamic | — | Number of values to process. |
inline function _Z_AssignUser(user, ptr)Writes an allocated payload offset through Doom's single-element owner-reference convention.
| Parameter | Type | Default | Description |
|---|---|---|---|
user | dynamic | — | User value supplied to `_Z_AssignUser`. |
ptr | dynamic | — | Ptr value supplied to `_Z_AssignUser`. |
_Z_blocklistTracks the mutable z blocklist value used by the z zone subsystem.
_Z_blocksHolds the optional z blocks resource used by the z zone subsystem.
_Z_bufHolds the optional z buf resource used by the z zone subsystem.
inline function _Z_FindBlockByPtr(ptr)Finds the allocated block whose payload begins at a zone-buffer offset, returning the sentinel index when absent.
| Parameter | Type | Default | Description |
|---|---|---|---|
ptr | dynamic | — | Ptr value supplied to `_Z_FindBlockByPtr`. |
inline function _Z_Get(i)Lazily initializes the zone and safely resolves an internal block-table index.
| Parameter | Type | Default | Description |
|---|---|---|---|
i | dynamic | — | Zero-based iteration index. |
const _Z_HDR = 0Defines z hdr for the z zone subsystem.
inline function _Z_IsFree(i)Treats a block as free exactly when it has no owner marker.
| Parameter | Type | Default | Description |
|---|---|---|---|
i | dynamic | — | Zero-based iteration index. |
inline function _Z_LinkAfter(aIdx, bIdx)Inserts one block after another and updates all four neighboring list links atomically.
| Parameter | Type | Default | Description |
|---|---|---|---|
aIdx | dynamic | — | A idx value supplied to `_Z_LinkAfter`. |
bIdx | dynamic | — | B idx value supplied to `_Z_LinkAfter`. |
inline function _Z_NewBlock(start, size, user, tag, id, next, prev)Constructs a block descriptor without linking it into the zone list.
| Parameter | Type | Default | Description |
|---|---|---|---|
start | dynamic | — | Start value supplied to `_Z_NewBlock`. |
size | dynamic | — | Requested size in bytes or elements. |
user | dynamic | — | User value supplied to `_Z_NewBlock`. |
tag | dynamic | — | Zone-memory or resource-lifetime tag. |
id | dynamic | — | Id value supplied to `_Z_NewBlock`. |
next | dynamic | — | Next value supplied to `_Z_NewBlock`. |
prev | dynamic | — | Prev value supplied to `_Z_NewBlock`. |
const _Z_NULL_OWNER_PTR = -1Defines z null owner ptr for the z zone subsystem.
_Z_roverTracks the mutable z rover value used by the z zone subsystem.
inline function _Z_Set(i, b)Updates a zone allocation block in the zone memory table.
| Parameter | Type | Default | Description |
|---|---|---|---|
i | dynamic | — | Zero-based iteration index. |
b | dynamic | — | Second input operand. |
_Z_sizeTracks the mutable z size value used by the z zone subsystem.
inline function _Z_Unlink(i)Removes a block descriptor from the doubly linked address list and clears its own links.
| Parameter | Type | Default | Description |
|---|---|---|---|
i | dynamic | — | Zero-based iteration index. |
memblock_t struct
const MINFRAGMENT = 64Defines the minimum minfragment accepted by the z zone subsystem.
const PU_CACHE = 101Defines pu cache for the z zone subsystem.
const PU_DAVE = 4Defines pu dave for the z zone subsystem.
const PU_LEVEL = 50Defines pu level for the z zone subsystem.
const PU_LEVSPEC = 51Defines pu levspec for the z zone subsystem.
const PU_MUSIC = 3Defines pu music for the z zone subsystem.
const PU_PURGELEVEL = 100Defines pu purgelevel for the z zone subsystem.
const PU_SOUND = 2Defines pu sound for the z zone subsystem.
const PU_STATIC = 1Defines pu static for the z zone subsystem.
function Z_BytesAt(ptr, length)Returns a byte slice copied from an absolute zone-buffer range.
| Parameter | Type | Default | Description |
|---|---|---|---|
ptr | dynamic | — | Ptr value supplied to `Z_BytesAt`. |
length | dynamic | — | Number of bytes or elements in the associated value. |
function Z_ChangeTag(ptr, tag)Exposes the validated retagging operation under the original zone API name.
| Parameter | Type | Default | Description |
|---|---|---|---|
ptr | dynamic | — | Ptr value supplied to `Z_ChangeTag`. |
tag | dynamic | — | Zone-memory or resource-lifetime tag. |
function Z_ChangeTag2(ptr, tag)Retags a validated allocation while forbidding purgeable tags on blocks without an owner reference.
| Parameter | Type | Default | Description |
|---|---|---|---|
ptr | dynamic | — | Ptr value supplied to `Z_ChangeTag2`. |
tag | dynamic | — | Zone-memory or resource-lifetime tag. |
function Z_CheckHeap()Verifies bidirectional links, contiguous address coverage, absence of adjacent free blocks, and the final zone extent.
function Z_ClearZone(zone)Replaces all allocator metadata with a sentinel and one free block covering the complete zone buffer.
| Parameter | Type | Default | Description |
|---|---|---|---|
zone | dynamic | — | Zone value supplied to `Z_ClearZone`. |
function Z_DumpHeap(lowtag, hightag)Prints allocator size and metadata for blocks in a selected tag range for diagnostics.
| Parameter | Type | Default | Description |
|---|---|---|---|
lowtag | dynamic | — | Lowtag value supplied to `Z_DumpHeap`. |
hightag | dynamic | — | Hightag value supplied to `Z_DumpHeap`. |
function Z_FileDumpHeap(f)Preserves the legacy file-dump entry point by emitting the complete heap through the active diagnostic output.
| Parameter | Type | Default | Description |
|---|---|---|---|
f | dynamic | — | F value supplied to `Z_FileDumpHeap`. |
function Z_Free(ptr)Validates and releases an allocation, invalidates its owner reference, and coalesces adjacent free blocks while repairing the rover.
| Parameter | Type | Default | Description |
|---|---|---|---|
ptr | dynamic | — | Ptr value supplied to `Z_Free`. |
function Z_FreeMemory()Totals immediately free and purgeable bytes to estimate memory available for a future allocation.
function Z_FreeTags(lowtag, hightag)Frees every allocated block whose purge tag lies in the inclusive requested range while preserving traversal across coalescing.
| Parameter | Type | Default | Description |
|---|---|---|---|
lowtag | dynamic | — | Lowtag value supplied to `Z_FreeTags`. |
hightag | dynamic | — | Hightag value supplied to `Z_FreeTags`. |
function Z_GetZoneBuffer()Returns the backing byte buffer addressed by all zone payload offsets.
function Z_Init()Obtains the platform zone buffer and initializes allocator metadata over its reported capacity.
function Z_Malloc(size, tag, user)Performs rover-based first-fit allocation, purges eligible tagged blocks, splits large remainders, and enforces owners for purgeable memory.
| Parameter | Type | Default | Description |
|---|---|---|---|
size | dynamic | — | Requested size in bytes or elements. |
tag | dynamic | — | Zone-memory or resource-lifetime tag. |
user | dynamic | — | User value supplied to `Z_Malloc`. |
function Z_PeekByte(ptr)Reads one byte at an absolute zone-buffer offset.
| Parameter | Type | Default | Description |
|---|---|---|---|
ptr | dynamic | — | Ptr value supplied to `Z_PeekByte`. |
function Z_PokeByte(ptr, v)Writes the low eight bits of a value at an absolute zone-buffer offset.
| Parameter | Type | Default | Description |
|---|---|---|---|
ptr | dynamic | — | Ptr value supplied to `Z_PokeByte`. |
v | dynamic | — | Value consumed by the operation. |
function Z_PokeBytes(dstPtr, srcBytes, srcOff, length)Copies a validated source byte range into the zone buffer at an absolute payload offset.
| Parameter | Type | Default | Description |
|---|---|---|---|
dstPtr | dynamic | — | Dst ptr value supplied to `Z_PokeBytes`. |
srcBytes | dynamic | — | Src bytes value supplied to `Z_PokeBytes`. |
srcOff | dynamic | — | Src off value supplied to `Z_PokeBytes`. |
length | dynamic | — | Number of bytes or elements in the associated value. |
const ZONEID = 1919505Defines zoneid for the z zone subsystem.