Re: Run Loop Memory Management



tir, 29 05 2007 kl. 18:12 -0500, skrev Dan Saul:
I am formerly a Macintosh developer. Currently however I am now working
on Objective C bindings for GTK+. I am currently looking at the
documentation for the run loop which I have found located at
http://developer.gnome.org/doc/GGAD/sec-mainloop.html . 

My question is, I need to implement the autorelease pool's run loop hook
that basically runs once every run loop cycle and frees memory. So far
guint gtk_idle_add(GtkFunction function, gpointer data); looks the most
promising for this purpose. However, being new to this library I would
like to get the opinions of those who are more experianced whether there
is a better -- or more appropriate place for me to put this code.

As far as I understand the autorelease thing, an idle handler is exactly
what you want, it will be run after the loop is done with processing
events and no more work remains. By returning an appropriate value you
can control how many times it'll be run.

Cheers,
Maciej

-- 
Being really good at C++ is like being really good at using rocks to
sharpen sticks. (Thant Tessman)
--------
Maciej Katafiasz <ml mathrick org>
http://mathrick.org




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