Next: Generational GC, Up: Garbage Collection [Contents][Index]
The following variables control the behavior of the garbage collector:
CMUCL automatically GC’s whenever the amount of memory
allocated to dynamic objects exceeds the value of an internal
variable. After each GC, the system sets this internal variable to
the amount of dynamic space in use at that point plus the value of
the variable ext:*bytes-consed-between-gcs*
. The default
value is 2000000.
This variable controls whether ext:gc
invokes the functions
in ext:*gc-notify-before*
and
ext:*gc-notify-after*
. If *gc-verbose*
is nil
,
ext:gc
foregoes printing any messages. The default value is
T
.
This variable’s value is a function that should notify the user that the system is about to GC. It takes one argument, the amount of dynamic space in use before the GC measured in bytes. The default value of this variable is a function that prints a message similar to the following:
[GC threshold exceeded with 2,107,124 bytes in use. Commencing GC.]
This variable’s value is a function that should notify the user when a GC finishes. The function must take three arguments, the amount of dynamic spaced retained by the GC, the amount of dynamic space freed, and the new threshold which is the minimum amount of space in use before the next GC will occur. All values are byte quantities. The default value of this variable is a function that prints a message similar to the following:
[GC completed with 25,680 bytes retained and 2,096,808 bytes freed.] [GC will next occur when at least 2,025,680 bytes are in use.]
Note that a garbage collection will not happen at exactly the new
threshold printed by the default ext:*gc-notify-after*
function. The system periodically checks whether this threshold has
been exceeded, and only then does a garbage collection.
This variable’s value is either a function of one argument or nil
.
When the system has triggered an automatic GC, if this variable is a
function, then the system calls the function with the amount of
dynamic space currently in use (measured in bytes). If the function
returns nil
, then the GC occurs; otherwise, the system inhibits
automatic GC as if you had called ext:gc-off
. The writer of
this hook is responsible for knowing when automatic GC has been
turned off and for calling or providing a way to call
ext:gc-on
. The default value of this variable is nil
.
Next: Generational GC, Up: Garbage Collection [Contents][Index]