For most programs, the default settings for the garbage collection parameters should suffice. For programs that have high global stack 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
global stack 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 global stack usage and the effectiveness of garbage
gc_marginhigher than the default will cause fewer global stack 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 global stack to expand so that if it does overflow, then the resulting garbage collection will significantly disrupt normal processing. This will be especially so if much of the global stack 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 global stack 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 global stack overflows is as follows:
gcis on and the global stack has grown at least
gc_marginkilobytes since the last garbage collection then garbage collect the global stack if less than
gc_marginkilobytes are reclaimed then try to expand the global stack endif else try to expand the global stack 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 global stack space, then
the global stack is not expanded after garbage collection completes.
Otherwise, the global stack is expanded after garbage collection. This
expansion provides space for the future global stack usage that will
presumably occur. In addition, no garbage collection occurs if the
global stack has grown less than
gc_margin kilobytes since the last garbage collection.