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

try-move-in-generation Function


Moves objects out of the most fragmented segment(s) in a generation, leaving them empty in 32-bit LispWorks.




try-move-in-generation generation-number time-threshold &optional fraction-threshold => result

An integer between 0 and the maximum generation number.
A real number.
A real number between 0 and 1.
A boolean.

The function try-move-in-generation finds the most fragmented segment in the generation specified by generation-number.

If generation-number is 0, then most recent generation is considered; if generation-number is 1 then the most recent two generations are considered and so on up to a maximum (usually 3). Numbers outside this range signal an error.

If time-threshold is positive, it moves objects out of this segment, leaving it empty, and repeats this operation until time-threshold seconds have elapsed. At this point try-move-in-generation returns, with value t if at least one segment was moved and value nil otherwise. Because the operation cannot be stopped in the middle, the actual time taken will always be larger than time-threshold.

fraction-threshold specifies the minimum fragmentation to actually move. The default is 0.25. If fraction-threshold is 1, try-move-in-generation does nothing. If fraction-threshold is 0, try-move-in-generation will move all uncompacted segments (unless it runs out of time). With the default (0.25) try-move-in-generation moves only moderately fragmented segments.

If time-threshold is negative, then try-move-in-generation does not actually move any segments. result is a boolean indicating whether try-move-in-generation would actually try to move a segment if it were to be called with a positive time-threshold and the other arguments unchanged.

This function is typically used after a call to check-fragmentation. For more information, see 11.3.11 Controlling Fragmentation.


try-move-in-generation is implemented only in 32-bit LispWorks. It is not relevant to the Memory Management API in 64-bit implementations, where marking-gc with the what-to-copy argument offers similar functionality (although set-blocking-gen-num is intended to solve the problem of fragmentation automatically).

See also

11.2 Guidance for control of the memory management system

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