Force a garbage collection

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.




forceGarbageCollection() forces a garbage collection to be performed. This function serves a highly technical purpose. Usually, there should be no need for a user to call this function.

Each time the interactive level is reached, the garbage collection routine is called. A heuristic algorithmn decides whether a garbage collection is really performed. After a call to forceGarbageCollection, a garbage collection will be forced on the next call of the garbage collection routine.


forceGarbageCollection does not cause an immediate garbage collection; it is only executed on returning to the interactive level. Therefore, it cannot be used in procedures to release memory during a longer computation.


Example 1

When the interactive level is reached, a garbage collection is performed:


Return Values

Void object of type DOM_NULL.

See Also

MuPAD Functions