On Apr 12, 2005, at 11:50 PM, Andrew White wrote:
This is a daemon that could run for some time. For a foundation tool, how does creating and freeing the autorelease pool tie into the event loop processing?
A Foundation tool manages its own run loop, if it even has one. So how you manage autorelease pools is entirely up to you.
If you're using an NSRunLoop, you might create a pool before processing each event, and release it after, just like NSApplication does in an AppKit app.
If your daemon is a network server that accepts incoming connections via BSD sockets or CFSockets, you might create a pool before handling each incoming request, and release it after.
Having a single autorelease pool that is not freed until program termination isn't a good idea for a program that may run for weeks.
Then don't do that. :-)
sherm--
--