From: Nick Roberts <nickroberts@callnetuk.com>
Subject: Re: memory leakages with Ada?
Date: Thu, 14 Mar 2002 20:42:56 +0000
Date: 2002-03-14T20:42:56+00:00 [thread overview]
Message-ID: <3C910B50.2030208@callnetuk.com> (raw)
In-Reply-To: pWLUJHzQF0ha@eisner.encompasserve.org
Larry Kilgallen wrote:
>In article <3c90af1e@news.starhub.net.sg>, "Calvin Ow" <calvow@cyberway.com.sg> writes:
>
>>Has Ada got any memory leakage problems like that of C?
>>
>
>Ada95 has several additional capabilities to guard against memory leaks.
>
Someone correct me if I'm wrong, but I think it would be more correct to
put it this way: the Ada language makes provision for an implementation
to provide garbage collection. If an Ada program is compiled/executed
under an implementation that provides garbage collection, then this
counts as a 'capability to guard against memory leaks'. If it provides
_full_ garbage collection, this will normally provide complete
protection against memory leaks.
However, all this is slightly academic, as (I am given to believe) there
are no Ada implementations that provide garbage collection (apart from
the ones which target the JVM, which is a somewhat different billie-can
of anchovies anyway). Without GC, dynamic allocation will cause memory
leakage (in the generally accepted meaning) unless: unused memory is
freed explicitly (by the use of Unchecked_Deallocation); or, the
algorithm uses (or tends to use) all or most dynamically allocated
objects up until the end of the scope of the relevant access type's
declaration (usually the end of the program's execution). This is pretty
much the same situation as with C.
Of course, memory leakage can also be caused, in any programming
language, by: faults in the compiler; programs doing low-level things,
and getting it wrong. Typically, utility libraries which provide
'containers' will need to do a lot of explicit freeing of memory; a bug
can easily cause memory leakage.
>It is possible to bypass most checks in Ada, so one could encounter
>just as much trouble in Ada if one attempted to transliterate a C
>program into Ada while retaining every aspect of the C design.
>
>>Especially with the use of Pragma calls to C?
>>
>
>If you call from Ada to C, the portion that is written in C is
>fully empowered to leak all the memory it wants :-) Thus the
>question of memory leaks when doing that boils down to an
>issue of whether the C code is well written.
>
Note that there are plenty of other kinds of problems associated with
memory management that Ada (both the standard language and typical
implementations) provides good protection against, and C does not.
next prev parent reply other threads:[~2002-03-14 20:42 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-14 14:07 memory leakages with Ada? Calvin Ow
2002-03-14 14:31 ` Larry Kilgallen
2002-03-14 20:42 ` Nick Roberts [this message]
2002-03-14 21:11 ` Larry Kilgallen
2002-03-14 21:07 ` Anh_Vo
2002-03-14 20:12 ` Marin David Condic
2002-03-15 9:37 ` John McCabe
2002-03-15 12:55 ` Pat Rogers
2002-03-16 4:36 ` Will
2002-03-16 4:53 ` Pat Rogers
2002-03-16 12:21 ` Larry Kilgallen
2002-03-16 9:13 ` DPH
2002-03-16 14:38 ` Pat Rogers
2002-03-16 14:56 ` DPH
2002-03-16 15:51 ` Preben Randhol
2002-03-16 16:39 ` DPH
2002-03-16 19:51 ` Pat Rogers
2002-03-16 20:40 ` DPH
2002-03-17 19:31 ` Richard Riehle
2002-03-17 21:49 ` Pat Rogers
2002-03-17 22:02 ` Pat Rogers
2002-03-18 22:32 ` Randy Brukardt
2002-03-18 22:47 ` Pat Rogers
2002-03-18 7:22 ` Richard Riehle
2002-03-18 17:35 ` Marin David Condic
2002-03-17 16:26 ` Steve Doiel
2002-03-16 20:18 ` Robert A Duff
2002-03-16 20:36 ` DPH
2002-03-15 14:20 ` Marin David Condic
2002-03-18 17:54 ` Warren W. Gay VE3WWG
2002-03-18 19:54 ` Hyman Rosen
2002-03-18 20:34 ` Larry Kilgallen
2002-03-18 21:18 ` Hyman Rosen
2002-03-18 21:45 ` Larry Kilgallen
2002-03-20 1:19 ` Hyman Rosen
2002-03-20 17:06 ` Warren W. Gay VE3WWG
2002-03-20 17:56 ` Larry Kilgallen
2002-03-20 17:48 ` Marin David Condic
2002-03-22 0:25 ` Matthew Woodcraft
2002-03-22 5:10 ` Hyman Rosen
2002-03-18 22:18 ` Marin David Condic
2002-03-20 20:49 ` Bertrand Augereau
2002-03-21 4:31 ` Will
2002-03-15 16:00 ` Hyman Rosen
2002-03-15 21:59 ` Chad R. Meiners
2002-03-17 5:43 ` Kevin Cline
2002-03-17 7:22 ` Chad R. Meiners
2002-03-18 4:09 ` Kevin Cline
2002-03-18 16:54 ` Chad R. Meiners
2002-03-18 17:38 ` Warren W. Gay VE3WWG
2002-03-19 9:21 ` John McCabe
2002-03-19 17:11 ` Warren W. Gay VE3WWG
2002-03-19 17:16 ` Pat Rogers
2002-03-19 17:51 ` David C. Hoos
2002-03-19 18:20 ` Frank J. Lhota
2002-03-19 23:43 ` Mark Johnson
2002-03-20 15:09 ` Frank J. Lhota
2002-03-17 7:27 ` Hyman Rosen
2002-03-18 3:52 ` Kevin Cline
2002-03-18 5:37 ` Hyman Rosen
2002-03-15 17:41 ` Kevin Cline
2002-03-15 18:00 ` Marin David Condic
2002-03-15 18:08 ` Hyman Rosen
2002-03-16 10:15 ` Kevin Cline
2002-03-14 23:14 ` Kevin Cline
2002-03-15 3:20 ` Steve Doiel
2002-03-15 9:32 ` John McCabe
2002-03-15 15:46 ` Hyman Rosen
2002-03-15 17:29 ` Kevin Cline
2002-03-15 15:48 ` Jeffrey Carter
2002-03-16 3:05 ` Steve Doiel
2002-03-16 20:19 ` Jeffrey Carter
2002-03-15 17:25 ` Kevin Cline
2002-03-15 18:03 ` Hyman Rosen
2002-03-16 10:07 ` Kevin Cline
2002-03-17 3:00 ` Hyman Rosen
2002-03-15 9:27 ` John McCabe
-- strict thread matches above, loose matches on Subject: below --
2002-03-20 6:25 Christoph Grein
2002-03-20 16:35 ` Hyman Rosen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox