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

NextPrevUpTopContentsIndex

mark-and-sweep

Function
Summary

Garbage collects a specified generation in 32-bit LispWorks.

This function is deprecated: use gc-generation instead.

Package

hcl

Signature

mark-and-sweep gen-number => bytes

Arguments

gen-number

0 for the most recent generation, 1 for the most recent two generations, and so on up to a maximum (usually 3). Numbers outside this range signal an error.

Values

bytes

The number of bytes allocated in that generation.

Description

mark-and-sweep is used to garbage-collect a specified generation of memory (and all lower generations). A call to this function forces the garbage collector to scan the specified generations. This can be of use in obtaining consistent timings of programs that require memory allocation. Alternatively, performance can sometimes be improved by forcing a garbage collection, when it is known that little memory has been allocated since a previous collection, rather than waiting for a later, more extensive collection. For example, the function could be called outside a loop that allocates a small amount of memory.

It is specially helpful to mark and sweep generation 2 when large, long-lived data structures become garbage, because by default it is never marked and swept. The higher the generation number the more time the mark-and-sweep takes, but also the more space recovered.

Notes

mark-and-sweep is implemented only in 32-bit LispWorks, and is deprecated. Use gc-generation instead.

mark-and-sweep is not relevant to the Memory Management API in 64-bit implementations. In 64-bit implementations you can use gc-generation or marking-gc.

Examples
(mark-and-sweep 0)  ; collect most recent generation
(mark-and-sweep 3)  ; collect all generations
See also

avoid-gc
block-promotion
get-gc-parameters
gc-generation
gc-if-needed
normal-gc
set-array-weak
set-gc-parameters
set-hash-table-weak
without-interrupts
with-heavy-allocation
Guidance for control of the memory management system


LispWorks User Guide and Reference Manual - 20 Sep 2017

NextPrevUpTopContentsIndex