comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Problems with controlled types, gnatmem thinks handle is leaking memory (long)
Date: 21 Feb 2005 20:12:34 +0000
Date: 2005-02-21T20:12:34+00:00	[thread overview]
Message-ID: <x7v650lk6z1.fsf@smaug.pushface.org> (raw)
In-Reply-To: pan.2005.02.20.23.09.14.990226@n_o_p_o_r_k_a_n_d_h_a_m.abyss2.demon.co.uk

"Luke A. Guest" <laguest@n_o_p_o_r_k_a_n_d_h_a_m.abyss2.demon.co.uk> writes:

> On Sun, 20 Feb 2005 19:09:02 +0100, Dmitry A. Kazakov wrote:

> > In Finalize: I check if Ref_Count = 0 before decrementing and raise
> 
> No need to check for the reference count to be 0, as it can never go
> negative and if it does, there's a problem with the code.

I believe it is possible for an object to be Finalized more than once.

> > if the Ref_Count is zero upon object's finalization. That helps a
> > lot!
> 
> I suppose I could raise an exception if the reference count isn't
> zero on finalisation, hmmm...but surely there would be an error in
> the code if that were not the case? Surely it's another example of
> what I mentioned above, it should never go wrong as long as the
> initialize, adjust & finalize subprograms have been implemented
> correctly.

It isn't a good idea to propagate an exception out of a Finalize
operation (it's a bounded error to do so, 7.6.1(14)).


-- 
Simon Wright                               100% Ada, no bugs.



  parent reply	other threads:[~2005-02-21 20:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-20 16:30 Problems with controlled types, gnatmem thinks handle is leaking memory (long) Luke A. Guest
2005-02-20 18:09 ` Dmitry A. Kazakov
2005-02-20 23:09   ` Luke A. Guest
2005-02-21  8:49     ` Dmitry A. Kazakov
2005-02-21 20:12     ` Simon Wright [this message]
2005-02-21 20:54       ` Dmitry A. Kazakov
2005-02-21 20:59         ` Robert A Duff
replies disabled

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