MemoryConstrained

MemoryConstrained[expr,b]

evaluates expr, stopping if more than b bytes of memory are requested.

MemoryConstrained[expr,b,failexpr]

returns failexpr if the memory constraint is not met.

Details

Examples

Basic Examples  (2)

Run a command until a memory limit is exceeded:

The loop ran until memory allocation for the result of Range exceeded the limit:

Wolfram Research (1988), MemoryConstrained, Wolfram Language function, https://reference.wolfram.com/language/ref/MemoryConstrained.html (updated 2007).

Text

Wolfram Research (1988), MemoryConstrained, Wolfram Language function, https://reference.wolfram.com/language/ref/MemoryConstrained.html (updated 2007).

BibTeX

@misc{reference.wolfram_2020_memoryconstrained, author="Wolfram Research", title="{MemoryConstrained}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/MemoryConstrained.html}", note=[Accessed: 16-January-2021 ]}

BibLaTeX

@online{reference.wolfram_2020_memoryconstrained, organization={Wolfram Research}, title={MemoryConstrained}, year={2007}, url={https://reference.wolfram.com/language/ref/MemoryConstrained.html}, note=[Accessed: 16-January-2021 ]}

CMS

Wolfram Language. 1988. "MemoryConstrained." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007. https://reference.wolfram.com/language/ref/MemoryConstrained.html.

APA

Wolfram Language. (1988). MemoryConstrained. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MemoryConstrained.html