Skip to content

checkAllocation

function checkAllocation(count, what): void;

Defined in: packages/engine/src/vm/AllocationBudget.ts:154

Refuse an allocation this evaluation cannot afford, without recording it.

For the sites that know how big a result will be BEFORE building it and whose result is charged later, when it is born. A matrix product is the case that matters: its size is the product of two operands that are each affordable, so it has to be refused from the shapes alone, before matrixMultiply() takes the memory. Charging here as well as at birth would bill every matrix twice and halve the ceiling the host asked for.

ParameterTypeDescription
countnumberHow many elements the result would have.
whatstringWhat they are, in the plural. See chargeAllocation.

void

ALLOCATION_LIMIT_EXCEEDED when the evaluation could not afford them.