Set a memory limit for the session
This functionality does not run in MATLAB.
Pref::maxMem(kbytes) Pref::maxMem(NIL) Pref::maxMem()
Pref::maxMem(kbytes) with kbytes greater than 0 sets a limit for the physically allocated memory of the current MuPAD® session. A computation exceeding this memory limit raises an error.
The physically allocated memory is the second of the values returned by bytes().
Note: The memory limit is "soft" because the memory is checked only occasionally. Usually, more memory is actually used before the excess is detected. Cf. Example 1.
The call Pref::maxMem() returns the current value of the memory limit without changing it.
The call Pref::maxMem(NIL) switches off the memory watch dog.
No computation should increase the memory usage of the current MuPAD session to more than a total of 10 megabytes:
Pref::maxMem(10 * unit::MByte):
The following loop creates larger and larger matrices until the memory limit is exceeded. Note that the current physical memory allocation returned by bytes() is measured in bytes:
for n from 100 to 150 step 5 do A := linalg::vandermonde([x.j $ j=1..n]); print(n, ceil(bytes()/1024)*unit::kByte); end_for:
Error: Out of memory [watchdog-memory]; Evaluating: linalg::vandermonde
Error: Out of memory. [watchdog-memory] Evaluating: linalg::vandermonde
Note that the memory limit was exceeded when computing the 115 ×115 Vandermonde matrix. However, because the memory consumption is measured only occasionally, this matrix was generated successfully without an error. Only in the next step, the memory watchdog recognizes excessive memory usage and aborts the computation of the 120×120 Vandermonde matrix.
Pref::maxMem(NIL): delete A:
Previously defined memory limit: 0 or an expression involving unit::MByte.