This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Documentation / Mathematica / Built-in Functions / System Interface / Memory Usage /

MemoryConstrained

FilledSmallSquare MemoryConstrained[expr, b] evaluates expr, stopping if more than b bytes of memory are requested.

FilledSmallSquare MemoryConstrained[expr, b, failexpr] returns failexpr if the memory constraint is not met.

FilledSmallSquare MemoryConstrained generates an interrupt to stop the evaluation of expr if the amount of additional memory requested during the evaluation of expr exceeds b bytes.

FilledSmallSquare MemoryConstrained evaluates failexpr only if the evaluation is aborted.

FilledSmallSquare MemoryConstrained returns $Aborted if the evaluation is aborted and no failexpr is specified.

FilledSmallSquare Aborts generated by MemoryConstrained are treated just like those generated by Abort, and can thus be overruled by AbortProtect.

FilledSmallSquare See Section 2.14.4.

FilledSmallSquare See also: TimeConstrained, MaxMemoryUsed, $RecursionLimit, Abort.

FilledSmallSquare New in Version 1.

Further Examples