Next: Macros Up: Memory Management Previous: Will Executors

# Garbage Collection

`(collect-garbage)` forces an immediate garbage collection. Since MzScheme uses a ``conservative'' garbage collector, some effectively unreachable data may remain uncollected (because the collector cannot prove that it is unreachable). This procedure provides some control over the timing of collections, but garbage will obviously be collected even if this procedure is never called.

`(current-memory-use)` returns an estimate of the number of bytes of memory occupied by reachable data. (The estimate is calculated without performing an immediate garbage collection; performing a collection generally decreases the number returned by `current-memory-use`.)

`(dump-memory-stats)` dumps information about memory usage to the (low-level) standard output port.