The macro block-promotion
executes body and prevents promotion of objects into generation 2 during this execution. After body is executed, generations 0 and 1 are collected.
This is useful when a significant number of transient objects actually survive all the garbage collections on generation 1. These would normally then be promoted and, by default, never get collected. In such a situation, (gc-generation t)
will free a large amount of space in generation 2. block-promotion
can be thought of as doing set-promotion-count on generation 1 with an infinite count, for the duration of body.
block-promotion
is suitable only for use in particular operations that are known to create such relatively long-lived, but transient, objects. In typical uses these are objects that live for a few seconds to several hours. An example usage is LispWorks compile-file, to ensure the transient compile-time data gets collected.
block-promotion
has global scope and hence may not be useful in an application such as a multithreaded server. During the execution of body, generation 1 grows to accommodate all the allocated data, which may have some negative effects on the behavior of the system, in particular on its interactive response.
block-promotion
cannot prevent these getting into that generation. allocation-in-gen-num can also cause allocation in higher generations.block-promotion
is implemented using set-blocking-gen-num.LispWorks User Guide and Reference Manual - 20 Sep 2017