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:

Introduced in 1988
 (1.0)
 |
Updated in 2007
 (6.0)