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

sweep-all-objects Function

Summary

Applies a function to all the live objects in the image.

Package

hcl

Signature

sweep-all-objects function &optional gen-0 => nil

Arguments
function
A function of one argument, the object.
gen-0
A generalized boolean, default value nil.
Description

The function sweep-all-objects calls function with all the live objects in the image. Normally it is not useful to sweep objects in generation 0 because they are ephemeral, so by default sweep-all-objects does not sweep generation 0. This can be changed by passing a non-nil value as gen-0.

function should take one argument, the object. It can allocate, but if it allocates heavily the sweeping becomes unreliable. Small amounts of allocation will normally happen only in generation 0, and so will not affect sweeping of other generations.

To call sweep-all-objects reliably, do it inside with-other-threads-disabled.

Notes

In 64-bit LispWorks and in the Mobile GC there is a more specific alternative: function sweep-gen-num-objects can be used to call a function on all live objects in a particular generation.

In the Mobile GC, sweep-all-objects does not sweep cons objects. There is also a more specific alternative: function mobile-gc-sweep-objects can be used to call a function on all live objects in particular generations.

See also

sweep-gen-num-objects
mobile-gc-sweep-objects


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