checkedArray
function checkedArray<T>(count, what): T[];Defined in: packages/engine/src/vm/AllocationBudget.ts:173
Check that an array is affordable, then allocate it.
The intended way to build any user-sized array inside the VM whose contents end up inside a Value that charges on birth, so that “ask before you take” is a property of the allocator rather than something each new opcode has to be told.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
count | number | Element count, checked before a single element exists. |
what | string | What the elements are, in the plural. See chargeAllocation. |
Returns
Section titled “Returns”T[]
An empty array of that length.
Throws
Section titled “Throws”ALLOCATION_LIMIT_EXCEEDED before allocating anything, when the
evaluation cannot afford it.