comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <Stephen.A.Leake@nasa.gov>
Subject: Re: Idea: use JGNAT for memory debugging?
Date: 05 Feb 2003 13:48:19 -0500
Date: 2003-02-05T19:01:29+00:00	[thread overview]
Message-ID: <uy94u5zt8.fsf@nasa.gov> (raw)
In-Reply-To: 3e40b4ae$0$344$bed64819@news.gradwell.net

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



  parent reply	other threads:[~2003-02-05 18:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-05  6:51 Idea: use JGNAT for memory debugging? Victor Porton
2003-02-05 10:32 ` Colin Paul Gloster
2003-02-05 12:12 ` Jeffrey Creem
2003-02-05 13:53 ` Victor Porton
2003-02-05 15:49 ` Idea: " Florian Weimer
2003-02-05 18:48 ` Stephen Leake [this message]
2003-02-06  2:00 ` Victor Porton
2003-02-07 18:22 ` Jean-Claude Mahieux
replies disabled

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