Mobile GC only: set the default static segment size, and optionally the size of the initial segment.
system
set-static-segment-size size &optional init-size => prev-size, prev-init-size
size⇩ |
A positive integer in the range #x10000 to #x1000000 or nil . |
init-size⇩ |
A positive integer in the range #x10000 to #x1000000 or nil . |
prev-size, prev-init-size | |
Integer. |
The function set-static-segment-size
sets the size of new static segments other than the initial one, and optionally the size of the initial one.
Normally you should not use static objects, because it makes the GC less efficient. However, in some circumstances it may be the best solution. In this situation set-static-segment-size
can be used to minimize the overhead.
The overhead for the GC depends on the number of segments, so it is best to minimize the number of static segments by making them larger. On the other hand, if a segment is not full, it wastes memory. Hence the ideal solution would be the smallest single segment that is large enough to accommodate all static allocation. You can check the current number and sizes of static segments by looking at the output of (room t)
.
By default, LispWorks allocates a small segment on startup of size 64 kB (#x10000). It actually uses very little of it (a few hundred bytes, up to several kB if you have many processes), and if your application uses only a few kB that should be enough. If there is further static allocation and the initial segment becomes full, then LispWorks allocates another segment of size 1 MB, and repeats this as needed.
set-static-segment-size
controls these sizes. size controls the size of all the static segments except the one that is allocated on startup. init-size controls the size of the initial segment.
The initial segment is allocated before your code is called on startup, so to set the initial segment size you need to call set-static-segment-size
before delivering the image. set-static-segment-size
gives an error if init-size is non-nil and the Mobile GC is already running.
A nil
value means do not change the value. Calling set-static-segment-size
with nil
is a way to get the current settings.
set-static-segment-size
returns the previous settings.
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:31:02