The function make-permanent-simple-vector
creates a simple-vector
of length size with initial element initial-element as if by the call (make-array
size :initial-element
initial-element)
, except that it is allocated as a permanent object when possible.
When not in the Mobile GC, simple-vector is allocated in the highest generation number.
In the Mobile GC, if size is larger than (ash 1 17)
(#x20000, 131072), so simple-vector is allocated in its own segment, it is made permanent. Otherwise it is allocated n generation 2.
make-permanent-simple-vector
is intended mainly for allocating large simple-vector
objects in the Mobile GC (that is, those that can be made permanent). When not in the Mobile GC, it does not do anything that make-array cannot do, but it may be convenient sometimes.
Note that, except for large simple-vector
objects in the Mobile GC, simple-vector is not actually permanent, and a GC of the highest generation will scan it (or free it if nothing point to it).
When simple-vector is permanent, and you do not need it any more, then you need to release it by release-object-and-nullify.
In the Mobile GC with large vectors, if initial-element is not supplied or it is an immediate or a permanent object, make-permanent-simple-vector
is much better than using make-object-permanent after a call to make-array, because it knows that it does not contain pointers to a lower generation.
make-object-permanent
release-object-and-nullify
allocated-in-its-own-segment-p
Special considerations for the Mobile GC
LispWorks User Guide and Reference Manual - 20 Sep 2017