Skip to content

@temporary-escape/mod-sdk / cabi_realloc

Function: cabi_realloc() ​

ts
function cabi_realloc(
   oldPtr: number, 
   oldSize: number, 
   align: number, 
   newSize: number
): number;

Defined in: abi.ts:33

Canonical-ABI allocation entry point, exported by the module and called reentrantly by the host to allocate inside the guest's linear memory.

oldSize is ignored because the AssemblyScript allocator tracks block sizes in its own header. The AssemblyScript heap is 16-byte aligned, so any align <= 16 is satisfied; the canonical ABI never requests more for the value types the game exchanges.

Parameters ​

ParameterType
oldPtrnumber
oldSizenumber
alignnumber
newSizenumber

Returns ​

number