comp.lang.ada
 help / color / mirror / Atom feed
* Link gnat with "purify" to try to find a memory leak
@ 2008-09-28 22:43 FJCS_Montecoruto
  2008-09-29  0:32 ` Jeffrey R. Carter
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: FJCS_Montecoruto @ 2008-09-28 22:43 UTC (permalink / raw)


Hi all,

A "memory leak" has been detected in one of our Gnat-Ada/GtkAda
executables. I was directed with others to try to find where exactly
is it located in our code.

Is it possible to somehow use "Rational Purify", to link it with our
Gnat-Ada/GtkAda objects, and so generate some instrumentalized
executable to run and test it under "Purify" ?.

If so, is there an "easy way" to be able to do it ?. We have tried,
but we have had a hard time linking the objects.

(I am also aware we have  "gnatmem" available to confirm the leakage,
which we did. But now we would need to isolate the problem more
precisely, in the middle of a big lot of source code lines ).

Any help appreciated,
Thank you,
FJCS



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Link gnat with "purify" to try to find a memory leak
  2008-09-28 22:43 Link gnat with "purify" to try to find a memory leak FJCS_Montecoruto
@ 2008-09-29  0:32 ` Jeffrey R. Carter
  2008-09-29  7:36 ` Dmitry A. Kazakov
  2008-09-29  8:32 ` xavier grave
  2 siblings, 0 replies; 4+ messages in thread
From: Jeffrey R. Carter @ 2008-09-29  0:32 UTC (permalink / raw)


FJCS_Montecoruto wrote:
> 
> A "memory leak" has been detected in one of our Gnat-Ada/GtkAda
> executables. I was directed with others to try to find where exactly
> is it located in our code.

Have you looked at GNAT.Debug_Pools?

-- 
Jeff Carter
"Now go away or I shall taunt you a second time."
Monty Python & the Holy Grail
07



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Link gnat with "purify" to try to find a memory leak
  2008-09-28 22:43 Link gnat with "purify" to try to find a memory leak FJCS_Montecoruto
  2008-09-29  0:32 ` Jeffrey R. Carter
@ 2008-09-29  7:36 ` Dmitry A. Kazakov
  2008-09-29  8:32 ` xavier grave
  2 siblings, 0 replies; 4+ messages in thread
From: Dmitry A. Kazakov @ 2008-09-29  7:36 UTC (permalink / raw)


On Sun, 28 Sep 2008 15:43:35 -0700 (PDT), FJCS_Montecoruto wrote:

> A "memory leak" has been detected in one of our Gnat-Ada/GtkAda
> executables. I was directed with others to try to find where exactly
> is it located in our code.
> 
> Is it possible to somehow use "Rational Purify", to link it with our
> Gnat-Ada/GtkAda objects, and so generate some instrumentalized
> executable to run and test it under "Purify" ?.
> 
> If so, is there an "easy way" to be able to do it ?. We have tried,
> but we have had a hard time linking the objects.

There is no easy way, but the starting point should be to review all
Gtk_New calls. Especially ones of initially owned objects. Differently to
floating objects, these require Unref called after the object is placed
into a container. Descendants of Gtk_Object are floating. Non-widgets are
usually owned. Missing Unref causes a leak.

Print the reference counts of suspicious objects. An object in the
container must have the count 1.

GtkAda contributions provides function Ref_Count that returns GTK's
reference count of an object. See

http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm#10.3

For tracing a GTK application you can use the procedure Trace defined in
Gtk.Main.Router. For example:

with Gtk.Main.Router;  use Gtk.Main.Router;
with GLib.Object.Ref_Count;

...
   Gtk.Main.Init;
   Gtk.Main.Router.Init; -- Before entering the main loop
...
   Trace ("Ref count" & GUInt'Image (GLib.Object.Ref_Count (Object));
...

See http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm#1.2

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Link gnat with "purify" to try to find a memory leak
  2008-09-28 22:43 Link gnat with "purify" to try to find a memory leak FJCS_Montecoruto
  2008-09-29  0:32 ` Jeffrey R. Carter
  2008-09-29  7:36 ` Dmitry A. Kazakov
@ 2008-09-29  8:32 ` xavier grave
  2 siblings, 0 replies; 4+ messages in thread
From: xavier grave @ 2008-09-29  8:32 UTC (permalink / raw)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

FJCS_Montecoruto a �crit :
> Hi all,
> 
> A "memory leak" has been detected in one of our Gnat-Ada/GtkAda
> executables. I was directed with others to try to find where exactly
> is it located in our code.
> 
> Is it possible to somehow use "Rational Purify", to link it with our
> Gnat-Ada/GtkAda objects, and so generate some instrumentalized
> executable to run and test it under "Purify" ?.
> 
> If so, is there an "easy way" to be able to do it ?. We have tried,
> but we have had a hard time linking the objects.
> 
> (I am also aware we have  "gnatmem" available to confirm the leakage,
> which we did. But now we would need to isolate the problem more
> precisely, in the middle of a big lot of source code lines ).
> 
> Any help appreciated,
> Thank you,
> FJCS

Hi,

I'm not used to purify, but I had a similar problem and I solved it
using valgrind.

My command looks like this :
valgrind --tool=memcheck --leak-check=full --show-reachable=yes -v
executable_name

or the same plus : --log-socket=127.0.0.1:12345
if you want to use valgrind-listener

Hope it will help, xavier
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjgkpMACgkQVIZi0A5BZF7M/gCfeXdz88nSVHaTjb/guwCXBA6G
260AnjKK1gOwLoox+/FHvm7z84DmJhev
=x8Gg
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-09-29  8:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-28 22:43 Link gnat with "purify" to try to find a memory leak FJCS_Montecoruto
2008-09-29  0:32 ` Jeffrey R. Carter
2008-09-29  7:36 ` Dmitry A. Kazakov
2008-09-29  8:32 ` xavier grave

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