Previous Section Next Section Table of Contents Glossary Index

Chapter 16. Understanding and Configuring the Garbage Collector

16.3. GC Page reclamation policy

After a full GC finishes, it'll try to ensure that at least (LISP-HEAP-GC-THRESHOLD) of virtual memory are available; objects will be allocated in this block of memory until it fills up, the GC is triggered, and the process repeats itself.

Many programs reach near stasis in terms of the amount of logical memory that's in use after full GC (or run for long periods of time in a nearly static state), so the logical address range used for consing after the Nth full GC is likely to be nearly or entirely identical to the address range used by the N+1th full GC.

By default (and traditionally in CCL), the GC's policy is to "release" the pages in this address range: to advise the virtual memory system that the pages contain garbage and any physical pages associated with them don't need to be swapped out to disk before being reused and to (re-)map the logical address range so that the pages will be zero-filled by the virtual memory system when they're next accessed. This policy is intended to reduce the load on the VM system and keep CCL's working set to a minimum.

For some programs (especially those that cons at a very high rate), the default policy may be less than ideal: releasing pages that are going to be needed almost immediately - and zero-fill-faulting them back in, lazily - incurs unnecessary overhead. (There's a false economy associated with minimizing the size of the working set if it's just going to shoot back up again until the next GC.) A policy of "retaining" pages between GCs might work better in such an environment.

Functions described below give the user some control over this behavior. An adaptive, feedback-mediated approach might yield a better solution.


Previous Section Next Section Table of Contents Glossary Index