comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: HELP memory leaks
Date: 1996/03/21
Date: 1996-03-21T00:00:00+00:00	[thread overview]
Message-ID: <DoMzpH.214@world.std.com> (raw)
In-Reply-To: 4irpob$bm5@esdmaster.dsd.northrop.com

In article <4irpob$bm5@esdmaster.dsd.northrop.com>,
Frank Falk <falk@dancer.dsd.northrop.com> wrote:
>I am being told two different things concerning memory leaks.  Please,
>someone tell me what to believe.

If you have pointers (access types), then you might have memory leaks.
So buy a compiler that supports garbage collection, or else be careful
with by-hand Unchecked_Deallocation.

If you don't use pointers, your compiler should not give you leaks,
IMHO.  Unfortunately, some do.  How to avoid that?  Well, you could buy
a compiler that does it right in all cases.  Or, you could deal with
specific problems.  I think some Ada compilers might leak memory for the
following:

    - Function calls, where the result type has a size not known at the
      call site.  E.g. "return String".
      
    - Local blocks, in a loop, that declare things whose size is not
      known at compile time.
      
    - Raising exceptions after allocating unknown-sized objects, but
      before plugging them in to known variables.
      
    - Aborting a task while it's allocating such things.

Other than that, there should be no problem.  But in any case, if a
compiler leaks memory (other than due to your own misuse of access
types), then send a bug report.

Avoiding all types whose size is not know at compile time, is overkill.
Avoiding the above-mentioned uses of such types might be wise, although
I still view memory leaks as bugs.

- Bob




      reply	other threads:[~1996-03-21  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-21  0:00 HELP memory leaks Frank Falk
1996-03-21  0:00 ` Robert A Duff [this message]
replies disabled

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