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

block-promotion Macro

Summary

Prevents promotion of objects into generation 2 during the execution of body.

Package

hcl

Signature

block-promotion &body body => result

Arguments
body
Lisp forms executed as an implicit progn.
Values
result
The result of evaluating the final form in body.
Description

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.

Notes
  1. Symbols and process stacks are allocated in generation 2 or 3 (see *symbol-alloc-gen-num*) hence block-promotion cannot prevent these getting into that generation. allocation-in-gen-num can also cause allocation in higher generations.
  2. In 64-bit LispWorks, block-promotion is implemented using set-blocking-gen-num.
See also

allocation-in-gen-num
mark-and-sweep
set-promotion-count


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