Re: Run Loop Memory Management
- From: "Brian J. Tarricone" <bjt23 cornell edu>
- To: gtk-app-devel-list gnome org
- Subject: Re: Run Loop Memory Management
- Date: Tue, 29 May 2007 16:37:04 -0700
Replying to myself...
On Tue, 29 May 2007 16:29:12 -0700 Brian J. Tarricone wrote:
Actually, you might want to poke around in gdk/quartz/ inside gtk+
SVN. I imagine autorelease pools are used in the MacOSX backend; maybe
you can find some hints there as to what's best.
I was curious, so I looked around. It looks like the gdk-quartz
backend allocs a new pool at the top of any function that uses
quartz/cocoa functions (which may or may not make use of objects that
use autorelease), and then releases the pool at the end of the
function.
Reading up on NSAutoreleasePool, it looks like they're "nestable" or
"stackable", in that the most-recently-created pool will always get
used when any object receives an 'autorelease' message. It sounds like
a bit of extra work on your part, but clearly someone thought this was
the right approach, and it feels much more correct to me than running a
cleanup function periodically via the main loop. Are
NSAutoreleasePools expensive to create and/or tear down? That's the
only argument I could see against this method.
-brian
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]