Re: apparent leak in widget creation/destroy



On Fri, Nov 18, 2005 at 09:56:24AM -0600, Boncek, John wrote:
We have 2 large C++ application programs using GTK 2.2.4 which have had
persistent problems in running out of memory.  We have narrowed the
problem down to a small test case, shown below, which consumes all
available memory until locking up the system.  We run this test case with
the free command in another terminal window to show free memory on a
half-second cycle, thus:
      free -o -m -s 0.5
The widget-creation call can be either gtk_fixed_new or
gtk_drawing_area_new.

The widget still has the initial floating reference, and
gtk_object_destroy() does not release any references itself.
The method to get rid of a maybe-floating GtkObject in
situation like yours is some variation on

    g_object_ref(object);
    gtk_object_sink(object);
    gtk_object_destroy(object);
    g_object_unref(object);

(you can explicitely test object state instead and branch
the code...)

Yeti


--
That's enough.



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