Generational GC: what to do when older generation overflows?

Ivan Boldyrev <[email protected]> Wed, 24 May 2006 15:30:34 +0700
Newsgroups gmane.comp.programming.garbage-collection.general
Organization this field is intentionally left blank
Message-ID <[email protected]>
I'm writing generational garbage collector based on Cheney algorithm.

When we collect objects from youngest generation into older one,
unpleasant situation may happen: there is no more space in older
generation but there are unprocessed objects in younger one.

I see two approaches for solving the problem:

1.  Before collecting data collector checks if older generation's size
    of free space is no less than size of younger semispace(s).  If
    not -- try older generation or total GC to oldest generation.

    But older generations may be processed too often here.

2.  When older heap overflows, restart GC with older generation as a
    target for GC, dealing with heap in partially collected state.
    But this solution seems to be unelegant, slow and hard to
    implement properly.

Different textbooks and articles about garbage collection seems to
ignore this issue completely.  May be, I overlook or misunderstand
something?

P.S.  Some background: I write GC for system without cycles, and there
are no pointers are from older generation to younger one.  It is a
part of runtime library for functional language SISAL.  I also need
some kind of finalization.  All previous implementations of this
language I know used counter GC.

-- 
Ivan Boldyrev

                       Perl is a language where 2 x 2 is not equal to 4.