comp.lang.ada
 help / color / mirror / Atom feed
* Freeing a dynamically allocated object
@ 1999-07-08  0:00 okellogg
  1999-07-08  0:00 ` Ted Dennison
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: okellogg @ 1999-07-08  0:00 UTC (permalink / raw)


What's the best way to deallocate a dynamically
allocated object (i.e. of an access-to-tagged type) ?
In good old Ada83, one would instantiate
the generic Unchecked_Deallocation package.
A C++ colleague of mine was asking me, where's
the "delete" in Ada95 ?

Thanks,

Oliver Kellogg


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Freeing a dynamically allocated object
  1999-07-08  0:00 Freeing a dynamically allocated object okellogg
@ 1999-07-08  0:00 ` Ted Dennison
  1999-07-09  0:00 ` Robert Dewar
  1999-07-09  0:00 ` John Duncan
  2 siblings, 0 replies; 6+ messages in thread
From: Ted Dennison @ 1999-07-08  0:00 UTC (permalink / raw)


In article <7m2b39$bvu$1@nnrp1.deja.com>,
  okellogg@my-deja.com wrote:
> What's the best way to deallocate a dynamically
> allocated object (i.e. of an access-to-tagged type) ?
> In good old Ada83, one would instantiate
> the generic Unchecked_Deallocation package.
> A C++ colleague of mine was asking me, where's
> the "delete" in Ada95 ?

That's it.

--
T.E.D.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Freeing a dynamically allocated object
  1999-07-08  0:00 Freeing a dynamically allocated object okellogg
  1999-07-08  0:00 ` Ted Dennison
@ 1999-07-09  0:00 ` Robert Dewar
  1999-07-09  0:00 ` John Duncan
  2 siblings, 0 replies; 6+ messages in thread
From: Robert Dewar @ 1999-07-09  0:00 UTC (permalink / raw)


In article <7m2b39$bvu$1@nnrp1.deja.com>,
  okellogg@my-deja.com wrote:
> What's the best way to deallocate a dynamically
> allocated object (i.e. of an access-to-tagged type) ?
> In good old Ada83, one would instantiate
> the generic Unchecked_Deallocation package.
> A C++ colleague of mine was asking me, where's
> the "delete" in Ada95 ?

It's still called unchecked_deallocation because it's
still unchecked, and still a potentially dangerous
operation. This is true in C++ as well, calling it
delete does not change these fundamental facts :-)


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Freeing a dynamically allocated object
  1999-07-08  0:00 Freeing a dynamically allocated object okellogg
  1999-07-08  0:00 ` Ted Dennison
  1999-07-09  0:00 ` Robert Dewar
@ 1999-07-09  0:00 ` John Duncan
  1999-07-12  0:00   ` Robert Dewar
  2 siblings, 1 reply; 6+ messages in thread
From: John Duncan @ 1999-07-09  0:00 UTC (permalink / raw)


If you use AppletMagic, garbage collection is automatically provided. That
is the safest way to deallocate unused objects. Despite the fact that the
standard allows for (and encourages, in my opinion) GC, I do not know of any
major vendors who support it.

-John






^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Freeing a dynamically allocated object
  1999-07-09  0:00 ` John Duncan
@ 1999-07-12  0:00   ` Robert Dewar
  1999-07-13  0:00     ` John Duncan
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Dewar @ 1999-07-12  0:00 UTC (permalink / raw)


In article <7m5edq$qec$1@usenet01.srv.cis.pitt.edu>,
  "John Duncan" <jddst19+@pitt.edu> wrote:
> If you use AppletMagic, garbage collection is automatically
provided. That
> is the safest way to deallocate unused objects.

You may not realize this, but the above statement is highly
controversial. If you are not aware of the issues, and are
not aware that this is controversial, you may want to go over
some old discussions of this issue (there are discussions in
CLA, but it is actually a much more widely discussed issue).
Certainly some people would agree with the above, but if
safety is taken to include real time performance, then it is
not nearly so clear!


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Freeing a dynamically allocated object
  1999-07-12  0:00   ` Robert Dewar
@ 1999-07-13  0:00     ` John Duncan
  0 siblings, 0 replies; 6+ messages in thread
From: John Duncan @ 1999-07-13  0:00 UTC (permalink / raw)


Sure, Robert, of course, but I hope no one is relying on a Java applet to
provide their real-time infrastructure:)

I should have specified that I meant in systems and applications programming
rather than in real-time systems, although there are safe garbage collectors
for these systems, and it is really a matter of whether you can put a bound
on the storage space used and assure that the development time saved by not
tracking down seemingly inevitable memory leaks is worth the possible
reduction in performance.

One thing is for sure, that the implementation can only make assertions
about recovery of unused storage and the validity of pointers using GC. If
GC does not exist, then it is up to the user to ensure that all dereferenced
pointers are valid and that all memory is eventually cleaned up. If you look
at the library routines in an R4RS-compliant scheme implementation, there
are appreciable bounds on storage space used. I rarely see guarantees about
this in any imperative language, although STL has some constraints in the
definition about storage of certain objects and access times for certain
elements of collections.

-John

Robert Dewar <robert_dewar@my-deja.com> wrote in message
news:7mdooq$l9$1@nnrp1.deja.com...
> In article <7m5edq$qec$1@usenet01.srv.cis.pitt.edu>,
>   "John Duncan" <jddst19+@pitt.edu> wrote:
> > If you use AppletMagic, garbage collection is automatically
> provided. That
> > is the safest way to deallocate unused objects.
>
> You may not realize this, but the above statement is highly
> controversial. If you are not aware of the issues, and are
> not aware that this is controversial, you may want to go over
> some old discussions of this issue (there are discussions in
> CLA, but it is actually a much more widely discussed issue).
> Certainly some people would agree with the above, but if
> safety is taken to include real time performance, then it is
> not nearly so clear!
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.






^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1999-07-13  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-08  0:00 Freeing a dynamically allocated object okellogg
1999-07-08  0:00 ` Ted Dennison
1999-07-09  0:00 ` Robert Dewar
1999-07-09  0:00 ` John Duncan
1999-07-12  0:00   ` Robert Dewar
1999-07-13  0:00     ` John Duncan

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