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

allocation-in-gen-num Macro

Summary

Allocates objects from a specified generation within the scope of evaluating a number of forms in 32-bit LispWorks.

Package

hcl

Signature

allocation-in-gen-num gen-num &body body => result

Arguments
gen-num
An integer.
body
Lisp forms.
Values
result
The result of evaluating body.
Description

The macro allocation-in-gen-num allocates objects from a generation specified by gen-num during the extent of the evaluation of body. If gen-num is out of range for a valid generation number, it is rounded either to the youngest or oldest generation. If gen-num is negative, the specified generation is: the highest generation number + 1 - gen-num, so that an argument of -1 specifies the highest generation number.

Normally objects are allocated from the first (youngest) generation, which assumes that they are short-lived. The memory allocator and garbage collector perform better if allocation of large numbers of non-ephemeral objects is done explicitly into a generation other than the youngest.

Notes

allocation-in-gen-num is implemented only in 32-bit LispWorks. In 64-bit implementations, use apply-with-allocation-in-gen-num or the :allocation argument to make-array instead.

Examples
(allocation-in-gen-num
     1
   (setq tab (make-hash-table :size 1200
                              :test 'eq)
         arr (make-array 20)))
See also

apply-with-allocation-in-gen-num
make-array
set-default-generation
get-default-generation
*symbol-alloc-gen-num*
11.3 Memory Management in 32-bit LispWorks


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