comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Garbage collection (was a spinoff of a spinoff of a GA
Date: 1996/10/25
Date: 1996-10-25T00:00:00+00:00	[thread overview]
Message-ID: <EACHUS.96Oct24211243@spectre.mitre.org> (raw)
In-Reply-To: JSA.96Oct22152111@alexandria


In article <JSA.96Oct22152111@alexandria> jsa@alexandria (Jon S Anthony) writes:

   > > Choice Two (in the spec): 
   > >   -- If you intend to use this data type, you had better ensure
   > >   -- that your compiler has a good garbage collector, or get an
   > >   -- add-on that can work with your compiler's allocation
   > >   -- methods.

   > Forget the "add-on" - that will at best be a conservative collector.  For
   > the precise collector:

   > Pro: ...
   >	Faster - allocations can be _much_ faster and collections can be
   >	much more efficient than good ol' "free".

   >	Works across the board (no need for special casing various situations)

   You must have been smoking some good stuff.  Precise collectors can
do the later, but never the former. Think for a second, any reclamation
the garbage collector can do, the free routine can do as well, without
the memory scan for live references.

  > > Choice Three (in the BODY):
  > > 
  > >    procedure Finalization (...) is
  > >    -- this will ensure that cleanup cannot be forgotten.

  > Con: Doesn't work everywhere

  >	Expensive (in time and space)

  >	Requires you to roll your own managers per type per application (but
  >	in those cases where it doesn't work, need to augment with other stuff
  >     - e.g. your own storage pools and management...)

  > > What are the cases Finalization doesn't cover?  (Other than those the
  > > programmer DECIDED not to apply it to.)

  > Lots's of places.  Finalization works pretty darn well for _stack_
  > allocated things, but pretty poorly (even not at all) for long lived
  > shared heap allocated things.  Since the latter are very important in
  > most large scale programs of any note, ...

    Let's take the absolute best example of a structure that "requires"
garbage collection an arbitrary graph consisting of nodes with
arbitrary numbers of edges, and cycles allowed.  Had to implement one
of those recently, and the requirements allowed nodes to be moved from
one graph to another.

   The finalization routine took five lines, and neat trick was in the
Adjust routine.  On assignment, a node (and all the nodes reached from
it) was given a new generation number (always incremented), positive
for the node assigned, and negated for all nodes reachable from it.
From a garbage collection point of view it was "extra overhead" but it
allowed me to do other operations such as reachability more
efficiently.  (You can't reach a node with a lower absolute generation
number.  The biggest win is that you only have to check against nodes
you have visited before with the current generation number.  Beats
marking and unmarking and allows more than one such operation to be
conducted simultaneously.)




--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




  reply	other threads:[~1996-10-25  0:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-21  0:00 Garbage collection (was a spinoff of a spinoff of a GA W. Wesley Groleau (Wes)
1996-10-22  0:00 ` Jon S Anthony
1996-10-25  0:00   ` Robert I. Eachus [this message]
1996-10-24  0:00     ` Garbage collection (was a spinoff of a spinoff of a GA diatribe) Hans-Juergen Boehm
1996-10-25  0:00       ` Robert A Duff
1996-10-25  0:00         ` Hans-Juergen Boehm
1996-10-25  0:00     ` Brian R. Hanson
1996-10-25  0:00   ` Garbage collection (was a spinoff of a spinoff of a GA Jon S Anthony
1996-10-27  0:00     ` Garbage collection (was a spinoff of a spinoff of a GA diatribe) Robert Dewar
1996-10-30  0:00   ` Jon S Anthony
1996-10-30  0:00     ` Robert Dewar
1996-10-31  0:00   ` Jon S Anthony
  -- strict thread matches above, loose matches on Subject: below --
1996-10-17  0:00 Garbage collection (was a spinoff of a spinoff of a GA W. Wesley Groleau (Wes)
1996-10-20  0:00 ` Robert A Duff
1996-10-21  0:00   ` Michael F Brenner
1996-10-21  0:00     ` Robert A Duff
1996-10-21  0:00     ` Larry Kilgallen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox