Looking for GtkWidget leaks



        So ... I suspect I'm doing something wrong with widget referencing
( almost certainly ) and quite possibly something wrong with GObject
referencing around the place.

        So - for peace of mind I re-built with G_ENABLE_DEBUG, and did a
g_type_init_with_debug () turning on object tracking. After usefully
catching a missed finalize chaining I switched to a GUI app.

        Problem is, on exit I seem to get a lot of noise ( or there are a
lot of leaks ) - are these objects staticaly cached somewhere ?:

GRuntime-Message: stale GObjects: 16
GRuntime-Message: [0x805f8b0] stale GdkVisual   ref_count=1
GRuntime-Message: [0x80601a8] stale GdkDevice   ref_count=1
GRuntime-Message: [0x805fde8] stale GdkWindowImplX11    ref_count=1
GRuntime-Message: [0x807e898] stale GdkWindow   ref_count=3
GRuntime-Message: [0x805f900] stale GdkVisual   ref_count=1
GRuntime-Message: [0x8060500] stale GdkColormap ref_count=26
GRuntime-Message: [0x805fb08] stale GdkWindow   ref_count=1
GRuntime-Message: [0x80908a8] stale GdkPixmap   ref_count=1
GRuntime-Message: [0x805f950] stale GdkVisual   ref_count=1
GRuntime-Message: [0x806e198] stale GtkStyle    ref_count=2
GRuntime-Message: [0x8090a00] stale GdkPixmapImplX11    ref_count=1
GRuntime-Message: [0x806e7b0] stale GdkImage    ref_count=1
GRuntime-Message: [0x80658e8] stale GtkSettings ref_count=2
GRuntime-Message: [0x807e8f8] stale GdkWindowImplX11    ref_count=1
GRuntime-Message: [0x805f860] stale GdkVisual   ref_count=1
GRuntime-Message: [0x8054608] stale GnomeProgram        ref_count=2

        From:

int
main (int argc, char **argv)
{
        GtkWidget *window;

        if (!bonobo_ui_init ("test-focus", VERSION, &argc, argv))
                g_error (_("Can not bonobo_ui_init"));
  
        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        gtk_window_set_title (GTK_WINDOW (window), "Control test");

        gtk_widget_show_all (window);

        gtk_widget_destroy (window);
  
        return bonobo_debug_shutdown ();
} 
  
        So ... quite possibly I'm doing something daft. Either way - in
libbonobo, bonobo-activation and the ORB we now have a set of shutdown
routines - the former two suffixed with _debug_shutdown that return a
status marker - to flag whether any resources were leaked.

        It would be _really_ excellent (for my regression tests) if we
could instate a similar (optional) method for glib [ preferably along with
not warning if nothing was leaked ], so that glib can be explicitely
shutdown and a status returned as to whether we leaked at all, which can  
result in a regression test failing.

        Of course - it would be lovely if we could have a similar method
in Gtk+ / pango [ I see a lot of pango stuff when I add a label ] that  
would clean up any stray resources that were intended to be lying around
(cached) before the GObject thing was run - oh and possibly do any more
paranoid checks that Gtk+ could do for us.
        
        Are you receptive to this idea ? the API would be purely optional,
hence it's name '_debug_shutdown' - not a harking back to the bad ol' days
of gtk_exit (), and similarly it cannot sensibly be done with an atexit
function - due to needing a status return - and atexit's are pretty
disliked anyway I understand.

        Thoughts ? it might well make all apps leak less and be more
robust, with pitifully little effort,

        Regards,

                Michael.

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot




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