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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,28f99e97a239682a X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Link gnat with "purify" to try to find a memory leak Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <0a839a05-adfc-4669-b0b5-47ae3c15b238@s50g2000hsb.googlegroups.com> Date: Mon, 29 Sep 2008 09:36:06 +0200 Message-ID: NNTP-Posting-Date: 29 Sep 2008 09:36:06 CEST NNTP-Posting-Host: 53dda7bc.newsspool1.arcor-online.net X-Trace: DXC=fZ?m<[`9WM[mG86`U=_nC_ic==]BZ:af^4Fo<]lROoRQ4nDHegD_]RUgD2C2gJaeDRDNcfSJ;bb[UFCTGGVUmh?TLK[5LiR>kgRW2cnRf\n8@\ X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:2128 Date: 2008-09-29T09:36:06+02:00 List-Id: 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