According to http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php/Debugging#Garbage_collection_threshold gambit has some controls:
Garbage collection threshold
Note the runtime parameters h (maximum compression level in kilobytes) and l (livepercent). See the reference guide for more information. Setting livepercent to five means that garbage collection will take place at a time when there is 19 times more memory in the memory allocated for objects that should be collected than there is memory allocated for objects that should not. The reason the livepercent option exists is to let you control how economical or generous the garbage collector should take up memory consumption, and how heavy / light it should be in CPU utilization.
You can always force garbage collection (## gc).
If you force garbage collection after a small number of operations or plan it constantly, or set livepercent to 90, then, presumably, gc will work often and will not do anything special in each run. This is likely to be more expensive overall, but avoid cost spikes. Then you can easily save on this expense to quickly make a service.
source share