Re: Gtk memory management... [How often do you see this...?]



On Wed, Apr 09, 2003 at 11:55:19AM +0800, Douglas Ian Linder wrote: 
> And since I'm here, I may as well ask (because I'm still
> uncertain about this) when the gtk_main loop exits for the
> final time (outer loop), are all resources released? If not,
> at what point should you release them (and how, if you haven't
> kept any pointers to objects to release)?
> 
> What if you're using gtk_main_iteration_do()? That function
> seems to always return TRUE (and according to the api ref'
> "Returns :TRUE if gtk_main_quit() has been called for the 
> innermost mainloop."), but no resources seem to be free'd
> or anything. 

The main loop doesn't have any relationship to memory management, it's
purely about monitoring sources of "events" (events broadly defined to
be input on file descriptors, time periods elapsing, GdkEvents
arriving, or whatever).

In C, you do have to free things by keeping pointers to them, in fact
most memory leak debuggers work by detecting things you no longer have
a pointer to. You can use a garbage collected language such as Python
with GTK though, to avoid this.

Havoc



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