[myObj performSelectorInBackground:@selector(doSomething) withObject:nil];
这种方式开启一个子线程执行任务的话,是否需要在 doSomething 里加入
@autoreleasepool {}
[myObj performSelectorInBackground:@selector(doSomething) withObject:nil];
这种方式开启一个子线程执行任务的话,是否需要在 doSomething 里加入
@autoreleasepool {}
2 回答1k 阅读
1 回答1.1k 阅读✓ 已解决
1 回答2.7k 阅读
1 回答1.5k 阅读
1 回答1.4k 阅读
1.7k 阅读
1 回答1.1k 阅读
three occasions when you might use your own autorelease pool blocks:
第3条:If you spawn a secondary thread.
If your application or thread is long-lived and potentially generates a lot of autoreleased objects, you should use autorelease pool blocks.If your detached thread does not make Cocoa calls, you do not need to use an autorelease pool block.