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

Re: finalize, dispose and destroy



Paul Pogonyshev wrote:
> Can anyone explain (point to explanation) the difference between these
> three methods?  I.e., when implementing a new widget, where do I put
> freeing of which resources?
[snip]

You should be safe with this:

static void
tea_kettle_finalize (GObject *object)
{
     /* Release any tea kettle resources.
      */
     TeaKettle  kettle* = TEA_KETTLE(object);

     g_free(kettle->steam);

     /* Chain up to parent
      */
     parent_class->finalize(object);
}

> Also is there a nice way to watch for memory leaks under GTK+?
> Valgrind seems to report many leaks that originate not in my program,
> but in X or GTK+.

None the less, I still use valgrind (lots of useless reports I get
about libpthread et al).

HTH,
                                    -Tristan




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