Skip to content

MemoryConstrained ​

Evaluates expr under a memory cap of bytes — real only in the isolated evaluator.

Wolfram LanguageMemoryConstrained!
MemoryConstrained(expr, bytes, failexpr)in-process, stays unevaluated; real only inside evaluateIsolated.

Domain: Controlling evaluation

Details
  • JavaScript cannot cap the memory a synchronous, in-process computation uses. In-process, MemoryConstrained therefore stays unevaluated rather than pretending to enforce a bound it cannot — silently ignoring the constraint would be worse than saying so plainly.
  • The bound is real inside @enumeratio/aestimatio/node's evaluateIsolated: the worker's own resourceLimits.maxOldGenerationSizeMb, a heap cap the runtime itself enforces.
  • Held: expr and failexpr are not evaluated in-process, since there is nothing here to run them under.

Examples