[gclist] Demand driven generational collector
Ji-Yong D. Chung
Thu, 4 Oct 2001 22:31:10 -0400
Here is one question about
(1) In implementing a generational collector,
I would like to make my collections be demand-driven.
By "demand-driven," I mean that a collection of
up to generation n occurs when generations
1 to n - 1 are likely to run out of memory.
Put it differently, the idea here is that when a
generation is used up above a certain threshold,
it is collected. Traditionally, major collections are
triggered when certain number of minor collections
have taken place.
Because the collection of each generation
is demand-driven, the collector will not attempt to
collect those generations merely because the
younger generations were collected a prespecified
number of times.
Does anyone know if there has been
a design of generational collector that works
this way, demand-driven? If so, how "well"
does it perform?
I have thought of one simple algorithm for
measuring whether generation n is likely to run
out of memory for the above "demand-driven"
I would greatly appreciate any comments,
critique of the algorithm, which is as follows:
Say we know that generation n should
be collected. We determine if generation n + 1
should be collected by seeing if there is
enough space on the generation n + 1
to accommodate a potential en-masse
promotion of generation n.
Here, 0 < n < max gen, so that
the preceding criteria can be applied
from generation 1 all the way to m,
where m is the first generation that
does not meets the criterion.
The algorithm starts with generation 0
(which is the nursery), whose
collection is triggered when it is filled
above certain threshold.