NextPrevUpTopContentsIndex

marking-gc

Function
Summary

Performs a Marking GC in 64-bit LispWorks.

Package

system

Signature

marking-gc gen-num &key what-to-copy max-size fragmentation-threshold

Arguments

gen-num

An integer in the inclusive range [0,7].

what-to-copy

One of the keywords :cons , :symbol , :function , :non-pointer , :other , :weak , :all or :default .

max-size

A positive number or nil .

fragmentation-threshold

A number in the inclusive range [0, 10].

Description

The function marking-gc garbage collects (GCs) the generation specified by gen-num, and all younger generations. It uses mark and sweep, rather than copy.

Mark and sweep garbage collection uses less virtual memory during its operation, but leaves the memory fragmented, which has a detrimental effect on the performance of the system afterwards. It is therefore not used automatically by the system, except to garbage collect static objects.

marking-gc is useful when you want to GC a generation which contains large amount (gigabytes) of data, to make sure there are no spurious pointers from this generation to a younger generation, and you do not expect many objects in the large generation to be collected. In this scenario, a Copying GC would use virtual memory which is almost double the size of the large generation during its operation, and so would possibly cause heavy paging.

Since repeated use of marking-gc will cause a lot of fragmentation, the arguments what-to-copy and max-size can be used to specify that part of the data should be collected by copying. Restricting the copying GC will reduce the amount of fragmentation that occurs.

what-to-copy specifies the allocation type to copy. It can be one of the main allocation types or :weak , meaning copy only objects in segments of that type. what-to-copy can also be :all , meaning copy objects in all segments. If what-to-copy is :default then each call to marking-gc chooses one of the main allocation types or :weak to copy, and successive calls with :default cycle through these allocation types.

max-size can be used to limit the amount that is copied, and thus limit the virtual memory that the operation needs. If max-size is non- nil , it specifies the limit, in gigabytes, of memory that can be used for copying. If there is more than max-size gigabytes of data of the type what-to-copy , the rest of this data is garbage collected by marking. The default value of max-size is nil , which means there is no limit on the amount that is copied.

fragmentation-threshold should be a number between 0 and 10. It specifies a minimum ratio between the free area in a segment that cannot be easily used for more allocation and the allocated area in this segment. Segments that are below this threshold are not copied. The default value of fragmentation-threshold is 1.

Note: this function is implemented only in 64-bit LispWorks. It is not relevant to the Memory Management API in 32-bit implementations.

See also

set-blocking-gen-num


LispWorks Reference Manual - 20 Jul 2006

NextPrevUpTopContentsIndex