| Sign In/My Account | View Cart |
| Article: |
Animating Graphics in Cocoa, Part 1 | |
| Subject: | Memory leak | |
| Date: | 2005-07-29 18:28:09 | |
| From: | valiantsoul | |
|
Response to: Memory leak
|
||
| Thats correct, watch NSCFDate in ObjectAlloc while the program is running - it gets called all the time but the peak amount of times an object of that type exists is 1 meaning no leak. | ||
Showing messages 1 through 1 of 1.
Here is my modified animate: with no leak:
- (void)animate:(id)anObject
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSDate *date = nil;
while (YES)
{
[self stepAnimation:nil];
[self setNeedsDisplay:YES];
if (date != nil)
[date release];
date = [NSDate dateWithTimeIntervalSinceNow:0.04];
[NSThread sleepUntilDate:date];
}
[pool release];
[NSThread exit];
}