Skip to content

This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.

checkAllocation

function checkAllocation(count, what): void;

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

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.