Re: Obj-C server and signal handling
Re: Obj-C server and signal handling
- Subject: Re: Obj-C server and signal handling
- From: Dave Camp <email@hidden>
- Date: Thu, 14 Feb 2008 11:32:53 -0800
On Feb 14, 2008, at 10:48 AM, Matt Mashyna wrote:
NSRunLoop *loopy = [NSRunLoop currentRunLoop];
while (keepRunning && [loopy runMode:NSDefaultRunLoopMode
beforeDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]);
Creating an NSDate in that tight loop will leak memory on each
iteration.
I've done something like this in the past (perhaps there is a better
way):
while (running && !gSigTerm)
{
NSAutoreleasePool *innerPool = [[NSAutoreleasePool alloc] init];
running = [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate dateWithTimeIntervalSinceNow:1.0]];
[innerPool release];
}
Dave
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden