All Manuals > LispWorks User Guide and Reference Manual > 40 The SYSTEM Package




Sets the additional allocation threshold that triggers a GC in the blocking generation in 64-bit LispWorks.




set-gen-num-gc-threshold gen-num threshold => old-threshold



An integer between 0 and 7, inclusive.


An integer greater than 12800, or a real in the inclusive range [0 100], or nil .



A number.


The function set-gen-num-gc-threshold sets the threshold for additional allocation that triggers a garbage collection (GC) in generation gen-num when this is the blocking generation (as set by set-blocking-gen-num). A GC is triggered when the allocation in generation gen-num grows more than threshold over the allocation after the last GC of this generation (or a GC of a higher generation).

To set the threshold, threshold can be an integer greater than 12800, which is interpreted as the absolute value. Alternatively threshold can be a real number in the inclusive range [0 100], which is multiplied by the allocation since the previous GC to get the actual threshold to set.

The default threshold for all generations is 1. That is, for all generations gen-num , when generation gen-num is the blocking generation and allocation in it has doubled since the previous GC, generation gen-num is collected automatically.

set-gen-num-gc-threshold can be called when the generation gen-num is not the blocking generation, and will set the value for that gen-num . Such a call will not take effect until the generation gen-num becomes the blocking generation, as set by a call to set-blocking-gen-num (with :do-gc non-nil).

Increasing the threshold reduces the number of GC calls, but may increase the virtual memory usage.

set-gen-num-gc-threshold returns the old threshold for the generation gen-num . It can be called with threshold nil to return the threshold value without changing it.


set-gen-num-gc-threshold is implemented only in 64-bit LispWorks. It is not relevant to the Memory Management API in 32-bit implementations.

See also


LispWorks User Guide and Reference Manual - 21 Dec 2011