All Manuals > LispWorks® User Guide and Reference Manual > 37 The HCL Package

clean-down Function

Summary

Frees memory and reduces the size of the image, if possible.

Package

hcl

Signature

clean-down &optional full => new-size

Arguments
full
A generalized boolean.
Values
new-size
A positive integer.
Description

The function clean-down 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 t.

If full is t, 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 nil, 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.

Notes
  1. 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.
  2. 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.
  3. In the Mobile GC, clean-down performs the same GC as (gc-generation t).
  4. 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.
See also

gc-generation
reduce-memory
save-image
try-move-in-generation
11.2 Guidance for control of the memory management system


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:35