FROM : Sherm Pendley
DATE : Wed Apr 13 07:40:16 2005
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--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
DATE : Wed Apr 13 07:40:16 2005
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--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
| Related mails | Author | Date |
|---|---|---|
| Andrew White | Mar 30, 04:42 | |
| John C. Warner | Mar 30, 04:51 | |
| Ondra Cada | Mar 30, 04:51 | |
| Andrew White | Apr 13, 05:50 | |
| Sherm Pendley | Apr 13, 07:40 |






Cocoa mail archive

