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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6ac8f960b3e80ee1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-02-05 10:57:37 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Idea: use JGNAT for memory debugging? Date: 05 Feb 2003 13:48:19 -0500 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: <3e40b4ae$0$344$bed64819@news.gradwell.net> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1044471689 17509 128.183.235.92 (5 Feb 2003 19:01:29 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 5 Feb 2003 19:01:29 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:33823 Date: 2003-02-05T19:01:29+00:00 List-Id: porton@ex-code.com (Victor Porton) writes: > I have a problem with an Ada program, which is possibly access to a > dangling reference (e.g. after Unchecked_Deallocation). > > Do I guess rightly that JGNAT (as opposed to normal Gnat) will detect > this problem for me? No. Instead, it will silently "fix" it for you; it won't actually deallocate the object until all the references are truly gone. > Is JGNAT free? Yes, in both the license and cost sense. > In general how to find dereferencing dangling references in Ada? I > would use an OO wrapper around accesses which would do reference > counting (in debug mode), but living entirely without accesses seems > bad. I agree, living without accesses is bad. But apparently you are also copying accesses; that takes more care. Reference counting is probably the best way to go here. But done right, it will only mask your problem (since the reference count will be incremented by the copy). So it depends on what you think "the problem" is; have you made an unnecessary copy of a pointer, or have you deallocated something before you were truly done with it? A careful review of your allocation/deallocation/copying policies and design will help. -- -- Stephe