Frees memory and reduces the size of the image, if possible.
clean-down &optional full => new-size
A generalized boolean.
A positive integer.
Tries to free as much memory as possible and then reduce the size of the image as much as possible, and also move all the allocated objects to an old generation.
full controls whether to operate on the highest generation. The default value of full is
If full is
clean-down does a mark and sweep on generation 3, promotes all the objects into generation 3, deletes the empty segments and tries to reduce the image size. This is called by default before saving an image.
If full is
clean-down does a mark and sweep on generation 2, promotes all the objects to generation 2 and tries to reduce the size of all generations up to 2, but does not touch generation 3.
clean-down returns the new size of the Lisp image after reduction, in bytes.
clean-down may fail to delete empty segments if there are static segments in high address space.
try-move-in-generation (which is implemented only in 32-bit LispWorks) uses less CPU than
clean-down, though it does not do the mark and sweep.
In 64-bit LispWorks,
clean-down is implemented as if by
(gc-generation 7 :coalesce t) though you can use gc-generation directly for better control.
In the Mobile GC,
clean-down performs the same GC as
clean-down may temporarily increase memory usage, and when called with full
nil may result in a larger Lisp image (though better organized, and therefore behaving better). In 32-bit LispWorks in situations where it is important not to increase memory usage, such as when the operating system signals that memory is low, use reduce-memory instead.
LispWorks User Guide and Reference Manual - 20 Sep 2017