memory management for deeper background work
Currently i do some job in class:
[userController startRegistrationForAllObjectsInFutureArrayForTableView:nil];
this is a function:
-开发者_StackOverflow中文版(void) startRegistrationForAllObjectsInFutureArrayForTableView:(id)tableView;
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^(void) {
... some job here
});
So, job is going to background. But i still need release class after all job will completed. So what is a way to solve it? Currently i do as here:
[userController retain];
[userController startRegistrationForAllObjectsInFutureArrayForTableView:nil];
}
[userController release];
[pool drain], pool = nil;
But i'm not sure if it work correct and what happened when autorelease pool is absent. Tnx
精彩评论