comp.lang.ada
 help / color / mirror / Atom feed
From: John Howard <jhoward@sky.net>
Subject: Re: Garbage Collection in Ada
Date: 1996/10/14
Date: 1996-10-14T00:00:00+00:00	[thread overview]
Message-ID: <Pine.GSO.3.93.961014050707.23547A-100000@sky.net> (raw)
In-Reply-To: 199610132138291604607@dialup101-6-14.swipnet.se


On Sun, 13 Oct 1996, Lars Farm wrote:
[snip]
> managing memory is a particularly nasty problem and GC solves it almost
> completely.
[snip]

GC just provides *automatic* deallocation of "unreachable" dynamically
allocated objects.  GC is not cost-free.  Ada 95 flexibly provides a
programmer with capable mechanisms to manually manage memory.  Plus the
safeguards of Ada help minimize creating slop to clean up and so the
deallocation can likely be managed easily enough manually.  I am not 
against using GC if its reliability is guaranteed and it saves me some 
money.  Otherwise I prefer to manually control the deallocation.

> Another common nonsense argument against GC is real time behaviour. GC
> is no different than ordinary allocators. They have no time constraints
> either. If one needs absolutely predictable timing one has to manually
> take over memory management for that section of code with GC and with
> ordinary allocators anyway.
>
> As for C++ the GC-dangerous constructs are very few and very obscure and
> luckily rarely used and easily avoided. Using them usually invokes
> "undefined behaviour" anyway (deliberately hiding pointers from the GC -
> on disk or with various xor tricks,...). In practice GC (conservative
> collector by Boehm) works very well with C++ and in my experience is
> faster than ordinary new/delete. If one also uses the fact that one has
> a GC in the design, things become faster still. Less need to copy
> datastructures (there is a lot of redundant copying in C++ out of fear
> that one wont know when to release memory otherwise). Granted, the speed
> is not just because of GC, but also because Boehms GC (that I have used
> in C++) is a much better allocator than the ones delivered with my dev
> systems.

You argue that GC is already worthwhile for the culture of C++ 
programming.  Perhaps it is most cost-effective if an operating system
does GC instead of having several programs doing their own GC.  That seems
to be a goal of the Java Virtual Machine.

[snip]
> Ada allows GC, C++ doesn't even acknowledge its existence.  One would
> have thought that the stricter Ada would be easier to adapt to GC than
> the "sloppy" C++.
[snip]
> Lars Farm, lars.farm@ite.mh.se

I argue that GC is far less worthwhile for the culture of Ada programming.
(Similarly Ada spared us from needing an equivalent C Lint program to 
clean up code).

From "Ada as a Second Language" (2nd ed.) by Norman Cohen, ISBN
0-07-011607-5, McGraw-Hill:
Section 8.2 p. 328
"
  The rules of Ada also allow "garbage collection"---automatic
  deallocation of dynamically allocated objects that are no longer
  pointed to by any other variables in the program, that are pointed
  to only by other dynamically allocated objects that are themselves
  no longer pointed to, and so forth.  Such objects are said to be
  unreachable because there is no way to refer to them. [...] Some
  implementations of garbage collection continually slow down a
  program's ordinary computations; other implementations are not
  invoked until the program needs more storage, at which point all
  ordinary computations are momentarily halted while the garbage
  collector does its work.  Either behavior is usually unacceptable
  in a real-time program.  Therefore, Ada provides a pragma allowing
  you to ensure---in the unlikely event that your compiler supports
  garbage collection---that the garbage collector will not get
  invoked.  The pragma Controlled ( access-type-name ); ensures that
  objects created by allocators for the named access type will not
  be garbage-collected. [...]

  There are many possible data structures and algorithms for managing
  the storage to be used for dynamic allocation and deallocation.
  One scheme may use up more space but take less time than another.
  The performance of some schemes may depend on the patterns of
  allocations and deallocations requested by your program.  [...]
  But certain highly tuned programs may require special
  storage-management schemes tailored to the application.
  Section 19.5.1 will describe advanced mechanisms for specifying
  programmer-defined subprograms to be invoked by the evaluation of
  an allocator or a call on an instance of Ada.Unchecked_Deallocation.
"
-- John Howard <jhoward@sky.net>               -- Team Ada  Team OS/2 --





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

Thread overview: 126+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-13  0:00 Garbage Collection in Ada Jonas Nygren
1996-10-13  0:00 ` Lars Farm
1996-10-13  0:00   ` Larry Kilgallen
1996-10-13  0:00   ` Robert Dewar
     [not found]     ` <19961014115513529729@dialup105-2-16.swipnet.se>
1996-10-16  0:00       ` Robert Dewar
1996-10-16  0:00         ` Lars Farm
1996-10-16  0:00           ` Robert Dewar
1996-10-16  0:00             ` Hans-Juergen Boehm
1996-10-17  0:00               ` Robert A Duff
1996-10-17  0:00                 ` Hans-Juergen Boehm
1996-10-17  0:00                 ` Larry Kilgallen
1996-10-17  0:00               ` Robert Dewar
1996-10-17  0:00                 ` Hans-Juergen Boehm
1996-10-17  0:00             ` Lars Farm
1996-10-23  0:00               ` Robert Dewar
1996-10-16  0:00         ` Hans-Juergen Boehm
1996-10-16  0:00           ` Robert Dewar
1996-10-16  0:00             ` Hans-Juergen Boehm
1996-10-17  0:00               ` Robert Dewar
1996-10-17  0:00                 ` Hans-Juergen Boehm
1996-10-17  0:00                   ` Robert Dewar
1996-10-14  0:00   ` John Howard [this message]
1996-10-15  0:00     ` Lars Farm
1996-10-15  0:00       ` Robert A Duff
1996-10-15  0:00       ` Robert Dewar
1996-10-15  0:00         ` Hans-Juergen Boehm
1996-10-15  0:00         ` Lars Farm
1996-10-17  0:00         ` Thomas Kendelbacher
1996-10-17  0:00           ` Robert Dewar
1996-10-23  0:00         ` Richard A. O'Keefe
1996-10-23  0:00           ` Larry Kilgallen
1996-10-14  0:00   ` Robert A Duff
1996-10-14  0:00     ` Lars Farm
1996-10-15  0:00       ` Robert A Duff
1996-10-16  0:00         ` Lars Farm
1996-10-16  0:00           ` Robert Dewar
1996-10-17  0:00             ` Robert A Duff
1996-10-19  0:00               ` Robert Dewar
1996-10-19  0:00                 ` Lars Farm
1996-10-20  0:00                   ` Robert Dewar
1996-10-20  0:00                     ` Robert A Duff
1996-10-20  0:00                       ` Robert Dewar
1996-10-21  0:00                     ` Geert Bosch
1996-10-21  0:00                       ` Hans-Juergen Boehm
1996-10-21  0:00                     ` Lars Farm
1996-10-21  0:00                       ` Robert Dewar
1996-10-21  0:00                         ` Lars Farm
1996-10-23  0:00                     ` Fergus Henderson
1996-10-24  0:00                     ` Richard A. O'Keefe
1996-10-20  0:00                 ` Robert A Duff
1996-10-20  0:00                   ` Robert Dewar
1996-10-21  0:00                     ` Hans-Juergen Boehm
1996-10-21  0:00                       ` Robert Dewar
1996-10-19  0:00               ` Richard Kenner
1996-10-15  0:00     ` Hans-Juergen Boehm
1996-10-15  0:00   ` Keith Thompson
1996-10-13  0:00 ` Robert Dewar
1996-10-14  0:00 ` Jon S Anthony
1996-10-15  0:00   ` Robert Dewar
1996-10-15  0:00 ` Hannes Haug
1996-10-15  0:00 ` Robert I. Eachus
1996-10-15  0:00   ` Robert Dewar
1996-10-16  0:00   ` whiting_ms@corning.com (Matt Whiting)
1996-10-16  0:00     ` Robert Dewar
1996-10-17  0:00   ` John Howard
1996-10-17  0:00     ` Robert Dewar
1996-10-18  0:00       ` Lars Farm
1996-10-19  0:00         ` Robert Dewar
1996-10-20  0:00           ` Lars Farm
1996-10-21  0:00             ` Nicolay Belofastow
1996-10-21  0:00               ` Robert Dewar
1996-10-21  0:00             ` Robert Dewar
1996-10-22  0:00               ` Lars Farm
1996-10-20  0:00         ` Robert A Duff
1996-10-20  0:00           ` Robert Dewar
1996-10-22  0:00         ` Mitch Gart
1996-10-23  0:00           ` Hans-Juergen Boehm
1996-10-27  0:00             ` Richard Riehle
1996-10-23  0:00           ` Fergus Henderson
1996-10-29  0:00         ` Jon S Anthony
1996-10-30  0:00         ` Brian Rogoff
1996-10-30  0:00         ` Jonas Nygren
1996-10-30  0:00         ` Jon S Anthony
1996-10-30  0:00         ` James Rogers
1996-10-18  0:00       ` Hans-Juergen Boehm
1996-10-18  0:00       ` Lars Farm
1996-10-20  0:00         ` Robert A Duff
1996-10-16  0:00 ` Jon S Anthony
1996-10-16  0:00 ` Jon S Anthony
1996-10-16  0:00 ` Ole-Hjalmar Kristensen FOU.TD/DELAB
1996-10-16  0:00   ` Robert Dewar
1996-10-16  0:00 ` Jon S Anthony
1996-10-16  0:00 ` Jon S Anthony
1996-10-17  0:00   ` Robert Dewar
1996-10-17  0:00 ` Hans-Juergen Boehm
1996-10-17  0:00 ` Rick Hudson
1996-10-17  0:00 ` Robert I. Eachus
1996-10-17  0:00   ` Robert Dewar
1996-10-17  0:00     ` Richard Kenner
1996-10-18  0:00 ` Jon S Anthony
1996-10-18  0:00   ` Robert Dewar
1996-10-18  0:00 ` Rick Hudson
1996-10-18  0:00 ` Jon S Anthony
1996-10-23  0:00   ` Robert Dewar
1996-10-21  0:00 ` Jon S Anthony
1996-10-21  0:00 ` Laurent Pautet
1996-10-22  0:00 ` Tapani Rundgren
1996-10-22  0:00 ` Jon S Anthony
1996-10-23  0:00 ` Jon S Anthony
1996-10-24  0:00   ` Mitch Gart
1996-10-24  0:00 ` Hans-Juergen Boehm
1996-10-24  0:00 ` Robert I. Eachus
1996-10-25  0:00 ` Jon S Anthony
1996-10-28  0:00 ` Robert I. Eachus
1996-10-29  0:00 ` Hans-Juergen Boehm
     [not found] <01bbc6a3$4cf03480$829d6482@joy.ericsson.se>
1996-10-31  0:00 ` Mitch Gart
1996-10-31  0:00   ` Jonas Nygren
1996-11-03  0:00   ` Matthew Heaney
1996-11-06  0:00     ` Robert A Duff
1996-11-06  0:00       ` Norman H. Cohen
1996-11-01  0:00 ` Jon S Anthony
1996-11-06  0:00 ` Brian Rogoff
1996-11-07  0:00   ` Tucker Taft
  -- strict thread matches above, loose matches on Subject: below --
1996-11-02  0:00 Jon S Anthony
1996-10-22  0:00 Brian Rogoff
1996-10-11  0:00 C++ Standardization (was: Once again, Ada absent from DoD SBIR solicitation) Dave Wood
1996-10-17  0:00 ` Garbage Collection in Ada Thomas Kendelbacher
replies disabled

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