Skip to content

SpecificationXIII · The engine inside

13.6

Engine limits

Limits are resources set by whoever runs the program —depth, statements, memory, time— and are not part of the language: a program that does not reach them gives the same result under any configuration.

Markdown version

13.6.1 How it works

LimitMeasured inWhen exhausted
depthactive framesfailure recursionDepthExceeded
cellslive heap valuesfailure cellLimitExceeded
statementsstatement entriescut statementBudgetExhausted
timethe host's clockcut without a diagnostic
live tasksspawned, unfinished tasksfailure taskLimitExceeded

The units are deterministic: they do not depend on the machine. An object takes one cell plus one per attribute; an array, one plus one per element; a text created at run time, one plus one per eight characters. Literals and what Write prints take no cells.

Figure 13.6-1.Four resources with their cap. Exhausting depth or cells is a program failure; exhausting statements or time is a limit cut.

Four bars: depth, full and marked as exhausted; cells, statements and time, partly full.

ProgramA recursion that exhausts depth

Subroutine Bajar(n As Integer) As Integer
  Return Bajar(n + 1) + 1;
EndSubroutine

Algorithm Profundo
  Write Bajar(0);
EndAlgorithm

Diagnostics

  • recursionDepthExceeded · error · 2:10 · Recursion depth limit reached: 100000

The program finishes with an error.

In short

  • Limits are configured by the host; they are not part of the language.
  • They are measured in deterministic units.
  • Depth and cells fail; statements and time cut.