comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Does memory leak?
Date: 23 Mar 1995 16:23:35 GMT
Date: 1995-03-23T16:23:35+00:00	[thread overview]
Message-ID: <EACHUS.95Mar23112335@spectre.mitre.org> (raw)
In-Reply-To: evans@evans.pgh.pa.us's message of Thu, 23 Mar 1995 08:54:32 -0500

In article <evans-230395085432@evans.pgh.pa.us> evans@evans.pgh.pa.us (Arthur Evans Jr) writes:

  > There are several areas where compilers in the early days of Ada leaked.
  > One is for a function that returns an unconstrained type.  You can't
  > allocate stack space for the returned value on the call side because you
  > don't know how much space is needed.  It's possible though tricky for
  > the callee to put the returned value on its own stack space and for the
  > caller to reclaim that space later.  Early implementations often put the
  > result on the heap,  and then some failed to release that space.  Later,
  > pressures of the market place forced such unpleasantness to be fixed.

    Yes, very true.  In the "early days" of Ada--and I certainly won't
mention names, since current compilers bear no relation--there were
"partial" Ada compilers, quickly brought to market, that had storage
leaks all over the place.  I never had this experience with a
validated compiler, although I know there were some leaks in some
versions of validated compilers.  But these were usually bugs, not
deliberate design omissions.

  > I suspect that the command line package Robert refers to returns type
  > STRING, an unconstrained type.

    No, the problem was that it retrieved a structure from the OS
containing the (parsed) parameters.  There was no easy way to tell
when the user finished making calls to the package without adding a
"finished with engines" call, so the structure was never released.  At
the time losing one to two thousand bytes of heap (or stack) was
noticable, but not really serious.

  > Note that several functions defined by the standard return unconstrained
  > types:
  >     Text_IO.Name
  >     Text_IO.Form
  > Beginners have a hard time figuring out how to call these.

   No, calling is easy--it's what to do with the result that is
hard. ;-)  Somehow it seems very counterintuitive that you must
declare an object as a constant only if you can't know the actual
size.  Fortunately this problem is gone in Ada 95.  One of the many
fixes to "little nits" that make Ada 95 so much nicer to use.

--

					Robert I. Eachus

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



  reply	other threads:[~1995-03-23 16:23 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-03-22  9:06 Does memory leak? Duncan Sands
1995-03-22 12:04 ` Fred J. McCall
1995-03-23  0:37 ` Robert I. Eachus
1995-03-23 13:54   ` Arthur Evans Jr
1995-03-23 16:23     ` Robert I. Eachus [this message]
1995-03-24 21:08   ` Norman H. Cohen
1995-03-28  0:00     ` Theodore Dennison
1995-03-31  0:00     ` Kent Mitchell
1995-03-23  2:08 ` T. Owen O'Malley
1995-03-24 11:44   ` Robert Dewar
1995-03-27 14:01     ` Theodore Dennison
1995-03-29  0:00       ` John DiCamillo
1995-03-30  0:00         ` Theodore Dennison
1995-03-30  0:00         ` Robb Nebbe
1995-03-30  0:00       ` Henry Baker
1995-04-04  0:00         ` John Baker
1995-04-05  0:00           ` Ray Toal
1995-04-05  0:00           ` Tucker Taft
1995-04-06  0:00             ` Norman H. Cohen
1995-04-07  0:00               ` Tucker Taft
1995-04-05  0:00           ` Pat Rogers
1995-04-05  0:00           ` Sverre Brubaek
1995-03-30  0:00   ` Robert I. Eachus
1995-03-23 22:38 ` Tucker Taft
1995-03-24  1:57 ` Henry Baker
1995-03-24 17:30   ` Larry Kilgallen, LJK Software
1995-03-26  0:00     ` Henry Baker
1995-03-27 15:19     ` Norman H. Cohen
1995-03-27 14:35   ` Kennel
1995-03-24 12:29 ` Mike Meier
1995-03-24 10:46   ` Fred J. McCall
1995-03-24 15:44   ` David Weller
1995-03-25  1:55   ` kkrieser
  -- strict thread matches above, loose matches on Subject: below --
1995-03-27  9:36 Duncan Sands
replies disabled

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