Re: Hybrid GC/explicit MMGs?

David Detlefs - Sun Microsystems Labs BOS <[email protected]> Wed, 30 Jun 2004 10:07:48 -0400
Newsgroups gmane.comp.programming.garbage-collection.general
Message-ID <[email protected]>
On a somewhat related note, the later Modula languages (Modula-2+,
Modula-3) allowed garbage-collected (traced) and explicitly managed
(untraced) storage in the same program.  Traced objects could contain
pointers to untraced objects, but not vice versa.  So you could if you
want pick certain types and manage them explicitly, as long as they
didn't need to contain pointers to objects you wanted GC'd.  (One
could certainly imagine implementations that loosened this
restriction, allowing pointers in both directions, treating the
explicitly managed heap as a source of roots.  I remember thinking
about possible implementation tricks to make this more efficient.)

But I'd like to argue that it's usually not worth it.  I conjecture
that usually when you're in a position to make a valid judgement that
some object has just become unreachable, it's because the object's
lifetime is short, and the set of variables that ever pointed to it is
small -- that's why you were able to make the decision.  If so, then I
argue that in language with a modern generational collector, such
short-lived garbage will be collected very efficiently.

Now if it's potentially long-lived garbage you're talking about
(deleted nodes in big tree structures, for example), then it's a
different story -- you might well get a win.  But be careful about
your reasoning here...

-- 
============================================= AntiSpamString: nix flubber now
=============================================================================
Dave Detlefs                           http://www.sunlabs.com/people/detlefs/
Sun Microsystems Laboratories                           [email protected]
1 Network Drive, Burlington, MA 01803-0902                     (781)-442-0841