Increase allocation threshold when promoting many objects to the mature generation
Summary
When garbage collection occurs prematurely, we may end up promoting many objects to the mature generation. To prevent this from happening too often, we should increase the allocation threshold when too many objects are promoted. This increase should be applied on any other increases that may have already been applied. Using this approach we delay garbage collection, thereby reducing the chance of promoting objects too soon.
Implementation
Tracing statistics produced by the collector would have to be passed to the methods used for reclaiming blocks in a LocalAllocator
. We also need a configuration option that controls the percentage of live objects to promote before increasing the allocation threshold.
Drawbacks
Without a way of reducing the threshold, we may delay garbage collecting too much; resulting in memory not being used as efficient as may otherwise be possible.