prog::memuse
-- memory usage of a
computationprog::memuse(
stmt)
shows the memory usage
for computation and loading library functions while evaluating
stmt
.
prog::memuse(stmt)
stmt |
- | a MuPAD statement |
the result of stmt
Pref::verboseRead
, prog::trace
, prog::profile
prog::memuse(
stmt)
shows the memory used
while evaluating stmt
.stmt
is evaluated by
prog::memuse
. If any function or library is loaded, prog::memuse
prints
the increment of memory usage.
In the end, a summary is printed showing the memory usage in two
parts: loadproc
means the memory used by loaded functions
and libraries, executing
means the memory allocated while
computing.
prog::memuse
is the result of the
evaluation of stmt
.prog::memuse
works only on Unix-like machines. It uses
the temporary file /tmp/mem.tmp.The example shows the memory usage of a first call of
the function testtype
: The library Type
and the object Type::Unknown
are loaded:
>> reset(): prog::memuse(testtype(x, Type::Unknown))
'LIBFILES/Type' : 16.4 kB 'TYPE/Unknown' : 1.4 kB loadproc = 17.9 kB executing = 0.4 kB All = 17.5 kB TRUE
The next example shows the memory usage for creating a
large MuPAD object. The result is not shown (suppressed by
:
):
>> prog::memuse([random()] $ i = 1..1000):
loadproc = 0.0 kB executing = 112.3 kB All = 112.3 kB
reset()
. This
saves a lot of time and memory. The library functions are loaded on
their first use, which may in some cases cause a noticeable delay on
the first invocation.