From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,714a9fe4718c9803 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!proxad.net!proxad.net!194.159.246.34.MISMATCH!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Problems with controlled types, gnatmem thinks handle is leaking memory (long) Date: 21 Feb 2005 20:12:34 +0000 Organization: Pushface Sender: simon@smaug.pushface.org Message-ID: References: <1s73d5wqz8pme.1m22aqftdn6ij.dlg@40tude.net> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1109016829 21250 62.49.19.209 (21 Feb 2005 20:13:49 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Mon, 21 Feb 2005 20:13:49 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: g2news1.google.com comp.lang.ada:8447 Date: 2005-02-21T20:12:34+00:00 List-Id: "Luke A. Guest" 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.