Re: Re[4]: Does GTK leak memory



On Thu, 2010-06-03 at 10:42 +0530, Ankur Verma wrote:

> LS >>> By the way, is there any way to find out what the reference count of
> LS >>> an object is?
> LS > Experimental printf statements to dump ref counter values are good to
> LS > understand which API function is adding a reference and which takes
> LS > ownership.
> 
> G_OBJECT(gtk_widget)->ref_count

this is a private member of GObject; while it's unlikely it will be
changed, there's no guarantee it'll be used forever.

also, as I said just in the paragraph you omitted to quote, it holds a
volatile value that could change beneath your seat, so its debugging
value it debatable (though it might be useful in certain well restricted
circumstances).

> LS > And a tool that just dumps me which objects are still alive would be
> LS > very helpfull too. MacOSX and MFC have features like this. Maybe GTK
> Ls > is really just another toy?
> 
> GObject Refcount debugger: http://refdbg.sourceforge.net/

this has long ceased to work because of the PLT changes in GLib to avoid
relocations - the LD_PRELOAD track only works with a special debug build
of GLib and nothing else.

in theory, you could rig valgrind to allow it to tap into the
refcounting process of GObject.

ciao,
 Emmanuele.

-- 
W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]