set-blocking-gen-num
gen-num
&key
do-gc
max-size
gc-threshold
=>
old-blocking-gen-num
,
do-gc
,
max-size
,
old-gc-threshold
An integer between 0 and 7, inclusive.
One of
t
,
nil
and
:mark
, or a real number between 0 and 10, inclusive.
A positive real number, or
nil
.
An integer greater than 12800, or a real in the inclusive range [0 100], or
nil
.
An integer between 0 and 7, inclusive.
One of
t
,
nil
and
:mark
, or a real number between 0 and 10, inclusive.
A positive real number.
A number.
The function
set-blocking-gen-num
sets
gen-num
as the generation that blocks. That is, no object is automatically promoted out of generation
gen-num
.
If
do-gc
is non-
nil
, then generation
gen-num
is automatically collected when needed, as defined by
gc-threshold
(see set-gen-num-gc-threshold).
The actual value of do-gc specifies how to GC the blocking generation when required. The possible values of do-gc are interpreted as follows:
Use Copying GC.
Use Marking GC.
A number in the inclusive range [0, 10]
Use Marking GC with copying of fragmented segments. The value specifies the fragmentation-threshold (the same as the argument to marking-gc). This is the ratio between the amount of free space that cannot be easily used and the amount of allocated space inside a segment. Only segments with fragmentation higher than the threshold are copied.
The default value of
do-gc
is
t
.
max-size is meaningful only if do-gc is a number. It specifies the maximum size in Gigabytes to try to copy. If the fragmented segments contain more data than this value, only some of them are copied in each GC.
If
gc-threshold
is non-
nil
, it is used to set the threshold for automatic GC using set-gen-num-gc-threshold.
The initial setup is as if this call has been made:
(sys:set-blocking-gen-num 3)
That is, the system will GC automatically according to the default gc-threshold using Copying GC.
Setting the blocking generation gen-num to a lower number is useful into two situations:
block-promotion
is a convenient way of doing that.
gc-generation
explicitly to promote long living objects to a higher generation. The advantage of doing this is that you can call
gc-generation
in places where you know there are not many short-lived objects alive.
Passing a
do-gc
value other than
t
is useful when the blocking generation can be large enough that copying it all may cause very serious paging. Passing
do-gc
:mark
will stop the system from copying the blocking generation, but may cause fragmentation if a significant number of long-lived objects die after a while, and there are not explicit calls to
gc-generation
or marking-gc.
set-blocking-gen-num
returns four values: the old blocking generation number, the old value of
do-gc
, the
max-size
, and the old value of
gc-threshold
. It can be called with
gen-num
nil
to query the values without changing any of them.
Note: this function is implemented only in 64-bit LispWorks. It is not relevant to the Memory Management API in 32-bit implementations.