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,cf8b802d278af5c9 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 16 Sep 2007 18:45:03 -0500 From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Ada newbie + Gtkada + Win2000 = ? Date: Mon, 17 Sep 2007 00:54:30 +0100 Reply-To: brian@shapes.demon.co.uk Message-ID: <1tdre3tgvbd015m2g8f648e800hre3dfk3@4ax.com> References: <6h8qe35tkcunqut5ufvjn299om46ku72uh@4ax.com> <17yxr4b662tt9$.1ki8b1ck4hreq.dlg@40tude.net> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 81.132.214.191 X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-4oPl9xg6F+y/VeyewBbu1PaG3kANg0NWdYWkp76Evis7FhDfk3VPeYpoDcWFmeMRL0RziQGBjAjCOpF!h96SVNMeyvKAhc9lYaxBrfmIIWMzy26h0cekB65yup46o9xXGmyHW8pd5bQMqa/DwqyGhvo3A0Rm!gtTi X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.35 Xref: g2news2.google.com comp.lang.ada:1961 Date: 2007-09-17T00:54:30+01:00 List-Id: On Sun, 16 Sep 2007 16:53:54 +0200, "Dmitry A. Kazakov" wrote: >On Sun, 16 Sep 2007 15:11:06 +0100, Brian Drummond wrote: > >> There are two mysteries here: - why the memory leaks occur; the GTK >> documentation claims it manages memory for you, and why it falls over so >> early (even when there is about 500MB of free memory) - if there is some >> heap limit imposed on the program, I can't see it. > >Well, GTK does not manage memory. Though, it has a reference counting model >for its objects, it does not provide handles to. The counts need to be >managed manually using Ref, Unref, Sink and Destroy. GtkAda is a thin >binding to GTK+, so it just follows this [IMO, flawed] design. > >In effect, when you call Gtk_New the result of is a plain pointer. It is >your responsibility to pass it back to a container type or else explicitly >kill the object. Note also as if that was not enough complicated, GTK has >widgets and other objects. When created both have the reference count 1. >But then for objects you do: > >1. put it into a GTK container (the count is now 2) >2. Unref (the count is 1 and the container holds the object) Thanks, that gives me a few things to look at. But so far, it looks like unref'ing anything that is GTK_New'ed from user code (i.e. the "testgtk" sources) results in releasing important objects; I believe I have to dig into GTK or GDK to find the problem. As you say, the problem seems to be getting handles to the things you need to free. >Sources are available at: I found some (presumably the correct vintage) on libre; haven't tried them yet. Next weekend probably. >For debugging reference counts you can use the Ref_Count function from: > >http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm#10.2 Thanks! - Brian