comp.lang.ada
 help / color / mirror / Atom feed
From: jsa@organon.com (Jon S Anthony)
Subject: Re: Q: Ada.Unchecked_Deallocation
Date: 1996/07/12
Date: 1996-07-12T00:00:00+00:00	[thread overview]
Message-ID: <JSA.96Jul12182314@organon.com> (raw)
In-Reply-To: 31E5D4D1.11DB36E1@jinx.sckans.edu


In article <31E5D4D1.11DB36E1@jinx.sckans.edu> David Morton <dmorton@jinx.sckans.edu> writes:

> If something is created dynamically with new, is it
> necessary to deallocate it with Ada.Unchecked_Deallocation,

Depends on several things.

> or will it be removed from the heap space when the program
> exits?

This certainly will happen without any help from you.  In fact the heap
itself goes away...


> From the "C" world, I've always been taught to clean up after
> myself... is this necessary?  It seems that usually, "Unchecked"
> anything in Ada is bad...

If you have a garbage collector (like the Intermetrics AppletMagic
Ada/Java system) then you need do nothing in this respect.  If you are
using controlled types for this sort of storage management you will
need to do nothing (well, not after building the types anyway).  If
your program does not allocate "much" as it runs and has a "short"
lifetime, you will not need to bother yourself.  If you have your own
automatic storage management using your own pools with automatic
collections, you will not have to bother (of course, that's a pretty
big "if" as you will have to build it or find one).  Other than that
(and probably a few more) you will need to use Unchecked_Deallocation.

NOTE: "Unchecked" stuff in Ada basically _is_ C stuff!  F'r'stance:
Unchecked_Deallocation is basically just good ol' free (at least from
the user's POV).

/Jon
-- 
Jon Anthony
Organon Motives, Inc.
1 Williston Road, Suite 4
Belmont, MA 02178

617.484.3383
jsa@organon.com





  parent reply	other threads:[~1996-07-12  0:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-11  0:00 Q: Ada.Unchecked_Deallocation David Morton
1996-07-12  0:00 ` Robert Dewar
1996-07-16  0:00   ` Robert I. Eachus
1996-07-21  0:00     ` Robert A Duff
1996-07-20  0:00   ` Laurent Guerby
1996-07-20  0:00     ` Robert Dewar
1996-07-21  0:00     ` Robert A Duff
1996-07-21  0:00   ` Robert A Duff
1996-07-21  0:00   ` Laurent Guerby
1996-07-12  0:00 ` Ron Thompson
1996-07-13  0:00   ` Robert Dewar
1996-07-21  0:00     ` Robert A Duff
1996-07-12  0:00 ` Jon S Anthony [this message]
1996-07-14  0:00 ` Andy Askey
1996-07-14  0:00   ` Robert Dewar
1996-07-27  0:00     ` Uri Shina
1996-07-30  0:00       ` Theodore E. Dennison
replies disabled

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