All Manuals > LispWorks® User Guide and Reference Manual > 47 The SYSTEM Package

set-maximum-segment-size Function


Defines the maximum segment size for a generation and allocation type in 64-bit LispWorks.




set-maximum-segment-size gen-num allocation-type size-in-mb => max-segment-size

An integer between 0 and 7, inclusive.
One of :cons, :symbol, :function, :non-pointer and :other.
An integer between 1 and 256 inclusive, or nil.
A number.

The function set-maximum-segment-size sets the maximum segment size for generation gen-num and allocation type allocation-type in 64-bit LispWorks.

allocation-type can be any of the main allocation types described in 11.4.2 Segments and Allocation Types.

size-in-mb is the size in megabytes.

For the non-ephemeral generations (that is, the blocking generation and above), if the system needs more memory of some allocation type in some generation, its normal operation is to enlarge one of the existing segments in this generation of this allocation type. If it does not find a segment that it can enlarge, it allocates a new segment of the same allocation type in the same generation. Therefore the maximum segment size affects the number of segments that will be used.

There is an overhead to using more segments, so normally having the largest segment size which the implementation allows (256MB) is the best. Reducing the size may be useful when using marking-gc with what-to-copy non-nil or set-blocking-gen-num with do-gc a number to prevent fragmentation in the blocking generation. In this situation, reducing the size of each segment makes it easier for the system to find segments to copy, even if the max-size-to-copy parameter is set to a low number to avoid using too much virtual memory.

The returned value, max-segment-size, is the previous maximum segment size.

If size-in-mb is a number, it specifies the size in megabytes. If size-in-mb is nil then set-maximum-segment-size returns the maximum segment size without altering it.


set-maximum-segment-size is implemented only in 64-bit LispWorks. It does nothing in the Mobile GC and its return value is not meaningful. It is not relevant to the Memory Management API in 32-bit implementations.

See also

11.4 Memory Management in 64-bit LispWorks

LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:31:02