Objective-C: Allocation in one thread and release in other
- by user423977
Hi
I am doing this in my Main Thread:
CCAnimation *anim; //class variable
[NSThread detachNewThreadSelector:@selector(loadAimation) toTarget:self withObject:nil];
In loadAimation:
-(void) loadAimation {
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
anim = [[CCAnimaton alloc] init];
[autoreleasepool drain];
}
And in main thread I release it:
[anim release];
Now I want to ask if this is fine regarding memory management.