comp.lang.ada
 help / color / mirror / Atom feed
From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: Multiple access to one object and deallocation
Date: Wed, 05 Nov 2003 14:52:52 +0100
Date: 2003-11-05T14:52:52+01:00	[thread overview]
Message-ID: <javhqvoli020dflacn3uu23s4ofbd64rn1@4ax.com> (raw)
In-Reply-To: TL6qb.25$_A.12638@sooner.brightok.net

On Wed, 05 Nov 2003 07:17:39 -0600, Harry Tucker
<snagaghash@sonetcom.com> wrote:

>My question is how to count references to an object so it will be 
>deallocated only after all references have gone out of scope or set to 
>null? An object reference could exist in several lists at any one time.

If "out of scope" means that the access type gets out and if the
target type is controlled, then all allocated objects for which
Unchecked_Deallocation was not called will be destroyed (AARM 7.6.1).

If "out of scope" means an access object, then you need something like
smart pointers. For example:

http://www.dmitry-kazakov.de/ada/components.htm

>What I'm looking for is an easy way to catch my own coding errors so I 
>don't bleed memory too much by overlooking a reference (access type).

Well, let me put it so: reference counting eliminates some errors by
introducing new errors. (:-))

---
Regards,
Dmitry Kazakov
www.dmitry-kazakov.de



  parent reply	other threads:[~2003-11-05 13:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-05 13:17 Multiple access to one object and deallocation Harry Tucker
2003-11-05 13:39 ` Marius Amado Alves
2003-11-05 13:52 ` Dmitry A. Kazakov [this message]
2003-11-05 14:10 ` Preben Randhol
replies disabled

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