Something like this? static NSAutoreleasePool *pool = nil;
void runloop(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info) { if (activity & kCFRunLoopEntry) { if (pool!=nil) [pool drain]; pool = [NSAutoreleasePool new]; } else if (activity & kCFRunLoopExit) { [pool drain]; pool = nil; } } CFRunLoopObserverContext context = {0, self, NULL, NULL, NULL}; CFRunLoopObserverRef observer = CFRunLoopObserverCreate(kCFAllocatorDefault, kCFRunLoopEntry | kCFRunLoopExit, YES, 0, runloop, &context); CFRunLoopAddObserver(CFRunLoopGetCurrent(), observer, kCFRunLoopDefaultMode); I know the way I'm doing it works, but I want to verify it's right. On Feb 18, 2011, at 9:58 PM, Kyle Sluder wrote: > Nest your own autorelease pool. You can use a runloop observer to make > sure it gets drained regularly. > > There's a constant somewhere that says what priority AppKit's > NSAutoreleasePool runloop observer uses, but I can't find it in the > documentation right now. You can insert yourself above that priority > to ensure that your runloop wraps AppKit's. > > --Kyle Sluder
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com