comp.lang.ada
 help / color / mirror / Atom feed
* access type question (maybe a little silly)
@ 2000-10-19  0:00 Carles
  2000-10-19  0:00 ` Pat Rogers
  2000-10-20  0:34 ` Ted Dennison
  0 siblings, 2 replies; 6+ messages in thread
From: Carles @ 2000-10-19  0:00 UTC (permalink / raw)


Do access type objects need to be destructed when they are not longer used?






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

* Re: access type question (maybe a little silly)
  2000-10-19  0:00 access type question (maybe a little silly) Carles
@ 2000-10-19  0:00 ` Pat Rogers
  2000-10-20  2:01   ` David Starner
  2000-10-20  0:34 ` Ted Dennison
  1 sibling, 1 reply; 6+ messages in thread
From: Pat Rogers @ 2000-10-19  0:00 UTC (permalink / raw)


"Carles" <e3128927@est.fib.upc.es> wrote in message
news:ezLH5.6327$Uk1.151137@telenews.teleline.es...
> Do access type objects need to be destructed when they are not
longer used?

That depends upon what you really mean by "access type objects".  If
you mean that literally, the answer is "probably not", since they are
likely declared on the stack.  (Yes one can have access values that
designate other access values, but that is somewhat unusual and will
be covered by the second part of the answer.)

In the following,

    type T is access all Integer;

    P : T;

the object P is of type T (I'm being somewhat loose with the
terminology; it won't hurt).   Object P could reasonably be called an
"access type object".

If what you really mean is "do the values *designated* by access type
objects need to be destroyed when no longer used" then the answer
depends.  After this statement,

    P := new Integer;

P.all is the (Integer) object designated by P, which comes out of some
pool (sort of a heap).   Does that integer need to be deallocated?
Depends upon what you're doing.  There is, however, likely no garbage
collector unless you're targeting to the JVM.  (I know of no Ada
compilers that provide GC apart from those that target the JVM, due to
lack of demand.)

If you're running an application that executes for a very long time,
then you might want to do the reclamation.  If you're running a
desktop, one-off, short-lived application, then it probably won't be
worth the effort.  The bottom line is that it depends upon the nature
of the application domain, the behavior of the program, and the
environment in which it runs.

---
Patrick Rogers                      Consulting and Training in:
http://www.classwide.com      Deadline Schedulability Analysis
progers@classwide.com        Software Fault Tolerance
(281)648-3165                       Real-Time/OO Languages

Adam ... does not deserve all the credit; much is due to Eve, the
first woman, and Satan, the first consultant.
Mark Twain






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

* Re: access type question (maybe a little silly)
  2000-10-20  2:01   ` David Starner
  2000-10-20  0:00     ` Pat Rogers
@ 2000-10-20  0:00     ` Robert Dewar
  1 sibling, 0 replies; 6+ messages in thread
From: Robert Dewar @ 2000-10-20  0:00 UTC (permalink / raw)


In article <8so92d$8a23@news.cis.okstate.edu>,
  dstarner98@aasaa.ofe.org wrote:
> On Thu, 19 Oct 2000 20:09:33 -0500, Pat Rogers wrote:
> >If you're running an application that executes for a very
long time,
> >then you might want to do the reclamation


Note that in Ada 95, you very likely will automate this
reclamation by using controlled types, in much the same
way you would use destructors in C++


Sent via Deja.com http://www.deja.com/
Before you buy.




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

* Re: access type question (maybe a little silly)
  2000-10-20  2:01   ` David Starner
@ 2000-10-20  0:00     ` Pat Rogers
  2000-10-20  0:00     ` Robert Dewar
  1 sibling, 0 replies; 6+ messages in thread
From: Pat Rogers @ 2000-10-20  0:00 UTC (permalink / raw)


"David Starner" <dvdeug@x8b4e516e.dhcp.okstate.edu> wrote in message
news:8so92d$8a23@news.cis.okstate.edu...
> On Thu, 19 Oct 2000 20:09:33 -0500, Pat Rogers wrote:
> >If you're running an application that executes for a very long
time,
> >then you might want to do the reclamation.  If you're running a
> >desktop, one-off, short-lived application, then it probably won't
be
> >worth the effort.
>
> I've never seen a program big enough to need access types that
wasn't
> worth it to try and collect it.

Depends on what you're writing.  In the last twenty years I've written
many Ada desktop programs that didn't need to bother with reclamation.
Many were allocator-intensive.

> I have, on the other hand, seen several
> small programs become quite a nuiscence by eating up hundreds of
megabytes
> of memory in seconds. If you've got a program that inputs files,
remember
> that the next guy will try to load a 100 MB picture/a half gig of
mp3s/
> the collected works of Shakespeare through your program.

But that wouldn't be a "one-off" program.







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

* Re: access type question (maybe a little silly)
  2000-10-19  0:00 access type question (maybe a little silly) Carles
  2000-10-19  0:00 ` Pat Rogers
@ 2000-10-20  0:34 ` Ted Dennison
  1 sibling, 0 replies; 6+ messages in thread
From: Ted Dennison @ 2000-10-20  0:34 UTC (permalink / raw)


Carles wrote:

> Do access type objects need to be destructed when they are not longer used?

Typically, yes. The generic routine Unchecked_Deallocation is used for this
purpose. Look it up in the Ada book of your choice.

--
T.E.D.

Home - mailto:dennison@telepath.com  Work - mailto:dennison@ssd.fsi.com
WWW  - http://www.telepath.com/dennison/Ted/TED.html  ICQ  - 10545591





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

* Re: access type question (maybe a little silly)
  2000-10-19  0:00 ` Pat Rogers
@ 2000-10-20  2:01   ` David Starner
  2000-10-20  0:00     ` Pat Rogers
  2000-10-20  0:00     ` Robert Dewar
  0 siblings, 2 replies; 6+ messages in thread
From: David Starner @ 2000-10-20  2:01 UTC (permalink / raw)


On Thu, 19 Oct 2000 20:09:33 -0500, Pat Rogers wrote:
>If you're running an application that executes for a very long time,
>then you might want to do the reclamation.  If you're running a
>desktop, one-off, short-lived application, then it probably won't be
>worth the effort. 

I've never seen a program big enough to need access types that wasn't
worth it to try and collect it. I have, on the other hand, seen several
small programs become quite a nuiscence by eating up hundreds of megabytes
of memory in seconds. If you've got a program that inputs files, remember
that the next guy will try to load a 100 MB picture/a half gig of mp3s/
the collected works of Shakespeare through your program.

-- 
David Starner - dstarner98@aasaa.ofe.org
http://dvdeug.dhis.org
If you wish to strive for peace of soul then believe; 
if you wish to be a devotee of truth, then inquire.
   -- Friedrich Nietzsche



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

end of thread, other threads:[~2000-10-20  2:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-19  0:00 access type question (maybe a little silly) Carles
2000-10-19  0:00 ` Pat Rogers
2000-10-20  2:01   ` David Starner
2000-10-20  0:00     ` Pat Rogers
2000-10-20  0:00     ` Robert Dewar
2000-10-20  0:34 ` Ted Dennison

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