Skip navigation.
 
mlRe: Obj-C server and signal handling
FROM : Dave Camp
DATE : Thu Feb 14 20:32:53 2008

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

Related mailsAuthorDate
mlObj-C server and signal handling Matt Mashyna Feb 14, 19:48
mlRe: Obj-C server and signal handling Dave Camp Feb 14, 20:32
mlRe: Obj-C server and signal handling Dave Camp Feb 14, 20:41
mlRe: Obj-C server and signal handling Uli Kusterer Feb 14, 20:54