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
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 mails | Author | Date |
|---|---|---|
| Matt Mashyna | Feb 14, 19:48 | |
| Dave Camp | Feb 14, 20:32 | |
| Dave Camp | Feb 14, 20:41 | |
| Uli Kusterer | Feb 14, 20:54 |






Cocoa mail archive

