Re: garbbage collection in gtk




>so my question is:
>       is there a specific garbbage collection mechanism for gtk objects?

Sort of?  Well, yes, but not the way you're thinking of I don't think.  C
doesn't have any garbage collection features, and there are'nt any built
into GTK AFAIK in the lisp/scheme/java sense, but what you're supposed to
do is this:

gtk_widget_destroy(some_widget);

That will destroy some_widget and everything underneath.  (i.e. if it's a
window, then all of the buttons, pictures, everything else in the window
dies too)

You don't have to worry about memory allocation as far as I know.  If you
have dynamically allocated some piece of memory somewhere without the help
of GTK+, you should probably free that, but don't worry about the widget
allocations because that's GTK+s business.

Whenever you're done with a window, just do
gtk_widget_destroy(some_window) and you don't have to worry about anything
else for all intensive purposes (somebody jump in and correct me on some
nitpicky point that I'm doubtlessly forgetting)

Hope it helps

http://opop.nols.com/ Free Software Development
==========================================================================
Der Horizont vieler Menschen ist ein Kreis mit Radius Null -- und das
nennen sie ihren Standpunkt.
==========================================================================
perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'



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