For most programs, the default settings for the garbage collection parameters should suffice. For programs that have high heap requirements, the default parameters may result in a higher ratio of garbage collection time to run time. These programs should be given more space in which to run.
gc_margin is a non-negative integer specifying the desired margin in
kilobytes. For example, the default value of 1000 means that the
heap will not be expanded if garbage collection can reclaim at least
one megabyte. The advantage of this criterion is that
it takes into account both
the user's estimate of the heap usage and the effectiveness of garbage
gc_marginhigher than the default will cause fewer heap expansions and garbage collections. However, it will use more space, and garbage collections will be more time-consuming when they do occur.
Setting the margin too large will cause the heap to expand so that if it does overflow, the resulting garbage collection will significantly disrupt normal processing. This will be especially so if much of the heap is accessible to future computation.
gc_marginlower than the default will use less space, and garbage collections will be less time-consuming. However, it will cause more heap expansions and garbage collections.
Setting the margin too small will cause many garbage collections in a small amount of time, so that the ratio of garbage-collecting time to computation time will be abnormally high.
The correct value for the
gc_margin is dependent upon many factors.
Here is a non-prioritized list of some of them:
The algorithm used when the heap overflows is as follows:
gcis on and the heap is larger than
gc_marginkilobytes then garbage collect the heap if less than
gc_marginkilobytes are reclaimed then try to expand the heap endif else try to expand the heap endif
The user can use the
gc_margin option of
gc_margin (see ref-lps-ove). If a garbage
collection reclaims at least the
gc_margin kilobytes of heap space
the heap is not expanded after garbage collection completes.
Otherwise, the heap is expanded after garbage collection. This
expansion provides space for the future heap usage that will
presumably occur. In addition, no garbage collection occurs if the
heap is smaller than