[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

generational GC


I was trying to decide how to divide up memory, and I ran into a minor
problem.  There don't seem to be enough bits to go around.  I was assuming
that I would just use some of the bits to indicate the generation, some
other bits to indicate the space, and a final bit to indicate new vs. old.

Well, on the pmax, all the code spaces have to be in the same 256 meg of
memory.  If there are 16 generations, then each generation can only be 16
meg total, i.e. 8 meg usable so we can flip.  But 8 meg is probably too
small for the permanent code generation, even ignoring the fact that we
have to tuck the C text segment in there somehow.  Even if we note that the
permanent generation never flips, we still only have 16meg to play with.
(Which probably isn't going to be enough.)

I see two solutions: either cut back on the number of generations, or have
different generations different sizes.

If we use one less bit for the generation, our permanent code space would
be 32 meg, which is probably large enough.

If we make different generations different sizes, it would be harder to
compare the age of two pointers, because we would no longer be able to just
extract some bits.  The easiest way to deal with different sized
generations would be to run 6 or 8 bits through a lookup table to find the
generation number.  We could even set it up so that bits1 >= bits2 -> gen1
>= gen2.  This would allow the greatest flexibility in dealing with
machines with strange address spaces.

I'm not real happy with either solution.  What do you think?