| Sign In/My Account | View Cart |
| Article: |
Animating Graphics in Cocoa, Part 1 | |
| Subject: | Memory leak | |
| Date: | 2003-08-22 15:18:45 | |
| From: | anonymous2 | |
|
Response to: Memory leak
|
||
| I'm not an expert, but I think this is not right. I tried it, and adding the release message makes everything crash after the loop ends. I think that dateWithTimeIntervalSince must be creating an already autoreleased object, no? | ||
Showing messages 1 through 2 of 2.
- (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];
}