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

set-promote-generation-1 Function


Mobile GC only: Set whether promotion occurs from generation 1 to 2.




set-promote-generation-1 on &optional promote-all => prev-value

A boolean.
nil, t or :full-gc.
A boolean.

The function set-promote-generation-1 controls whether promotion can occur from generation 1 to 2. LispWorks starts with promotion on, so objects in generation 1 that survive a GC are promoted to generation 2. Calling set-promote-generation-1 with on nil changes the behavior to leave those objects in generation 1.

set-promote-generation-1 can be repeatedly called to switch promotion on or off. It affects all threads.

When on is nil and promote-all is non-nil then set-promote-generation-1 promotes all currently live objects to generation 2, and then switches off promotion of generation 1. If promote-all is t, this promotion is done by a GC of generation 1. If promote-all is :full-gc, it is done by a GC of generation 2.

set-promote-generation-1 returns the previous setting.


Blocking promotion of generation 1 prevents "generation leaks", that is promotion of objects to generation 2 that die not long afterwards, but it causes growth of generation 1, which makes GC of generation 1 slower. As long as generation 1 is not too large, then that is not a problem, and blocking the potential leaks into generation 2 is useful. If generation 1 grows as a result of blocking promotion, GC of generation 1 starts to take noticeable time, and it is better not to block but to tune generation 2.

See also Preventing/reducing GC of generation 2

LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:31:02