Under a 32-bit operating system, where maximum memory allocated to any one program is limited, Mathematica gracefully terminates the kernel and returns a max memory allocation error.
On a 64-bit OS however, Mathematica will freely use all the memory available and grind the system to a halt. Therefore, what is the correct way to cap memory usage? One could use MemoryConstrained
combined with $Pre
or CellEvaluationFunction
but I would rather not tie up either of those for this purpose, or have to modify existing uses to incorporate this function.
Is there another way to globally restrict memory usage, such as a kernel flag, or system $Option?