Set a memory limit for the session
MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
kbytes) Pref::maxMem(NIL) Pref::maxMem()
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
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.
Pref::maxMem() returns the current
value of the memory limit without changing it.
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
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