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

NextPrevUpTopContentsIndex

reduce-memory

Function
Summary

Attempts to reduce the size of the Lisp image, without enlarging it even temporarily.

Package

hcl

Signature

reduce-memory &optional full => new-size

Arguments

full

A generalized boolean.

Values

new-size

A positive integer.

Description

The function reduce-memory frees memory and tries to reduce the size of the Lisp image, without enlarging it even temporarily. It is implemented only in 32-bit LispWorks.

reduce-memory has the same effect as clean-down, except that clean-down may temporarily increase the size of the image in order to be able to promote from lower generations. reduce-memory never increases the image size, which means that it may fail to promote. This will cause future garbage collections to be slower, until the promotion actually occurs.

reduce-memory is intended to be used when the operating system signals that the memory is low. Using clean-down in this situation may cause a temporary increase in size, which may cause the system to run out of memory, or maybe just kill the Lisp process. In other circumstances clean-down should do a better job (and you might also consider try-move-in-generation).

If full is nil, reduce-memory frees memory and promotes live objects to generation 2. When full is non-nil, reduce-memory frees and promotes to generation 3. The default value of full is nil.

reduce-memory returns the new size of the Lisp image after reduction, in bytes.

Notes
  1. The default of full is nil, which is different from clean-down where it defaults to t.
  2. reduce-memory with no argument or nil differs from (clean-down nil) by trying to reduce the memory. (clean-down nil) frees and promotes, but does not try to reduce the size (and may actually increase it).
  3. reduce-memory is implemented only in 32-bit LispWorks.
See also

clean-down
try-move-in-generation


LispWorks User Guide and Reference Manual - 13 Feb 2015

NextPrevUpTopContentsIndex