nsthread autoreleased with no pool in place – just leaking警告的解决方法
2013-03-06 10:40
447 查看
XXXXX nsthread autoreleased with no pool in place - just leaking
这是一个会经常发生的警告提示。
当调用
[NSThread detachNewThreadSelector:@selector(XXX) toTarget:self withObject:nil];
发起一个多线程的时候会发生这种警告,那么,加上NSAutoreleasePool就可以了,NSAutoreleasePool我的理解是一个自动的进程管理池,当然并不代表着有Java或者AS3的强大GC机制。
[NSThread detachNewThreadSelector:@selector(ooxx) toTarget:self withObject:nil];
- (void)ooxx
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
//OOXX,if you like:)
[pool release];
}
关于NSAutoreleasePool可以查看Apple 的官方文档:NSAutoreleasePool
Class Reference
另外,需要注意的是,在多进程中要操作主进程的UI是不可以直接操作的,一定要使用:performSelectorOnMainThread
from:http://hi.baidu.com/liaomingsen/blog/item/d9b71a639b91677b0d33faeb.html
这是一个会经常发生的警告提示。
当调用
[NSThread detachNewThreadSelector:@selector(XXX) toTarget:self withObject:nil];
发起一个多线程的时候会发生这种警告,那么,加上NSAutoreleasePool就可以了,NSAutoreleasePool我的理解是一个自动的进程管理池,当然并不代表着有Java或者AS3的强大GC机制。
[NSThread detachNewThreadSelector:@selector(ooxx) toTarget:self withObject:nil];
- (void)ooxx
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
//OOXX,if you like:)
[pool release];
}
关于NSAutoreleasePool可以查看Apple 的官方文档:NSAutoreleasePool
Class Reference
另外,需要注意的是,在多进程中要操作主进程的UI是不可以直接操作的,一定要使用:performSelectorOnMainThread
from:http://hi.baidu.com/liaomingsen/blog/item/d9b71a639b91677b0d33faeb.html
相关文章推荐
- *** __NSAutoreleaseNoPool(): Object 0x6013810 of class __NSArrayI autoreleased with no pool in place
- __NSAutoreleaseNoPool(): ... utoreleased with no pool in place - just leaking
- NSAutoReleaseNoPool(): Object 0x********* of class NSConreteData autoreleased with no pool in place
- __NSAutoreleaseNoPool(): ... utoreleased with no pool in place - just leaking
- 关于NSAutoreleasePool' is unavailable: not available in automatic reference counting mode的解决方法
- 警告: No mapping found for HTTP request with URI [/web002/list.do] in DispatcherServlet 的解决方法
- ARC 工程出现错误__NSAutoreleaseNoPool(): Object 0x8850ce0 of class __NSCFData autoreleased with no pool in
- 关于NSAutoreleasePool' is unavailable: not available in automatic reference counting mode的解决方法 .
- Web.xml文件提示No grammar constraints (DTD or XML Schema) referenced in the document. 警告的解决方法
- 相对路径获取项目文件 及报错 No mapping found for HTTP request with URI XXX in DispatcherServlet with name ‘springmvc’解决方法
- No mapping found for HTTP request with URI [/...] in DispatcherServlet with name ...的解决方法
- No mapping found for HTTP request with URI [/app17a/] in DispatcherServlet with name 'springmvc'解决方法
- Android-68-Tomcat各种启动错误的解决的方法,如:Exception in thread "Thread-6" NoClassDefFoundError,Document base E:\
- java Exception in thread "main" java.lang.NoClassDefFoundError: (wrong name: 解决方法
- 警告: No mapping found for HTTP request with URI [/Springmvc/test] in DispatcherServlet with dispatche
- Keil编译出现“Error: L6406W: No space in execution regions with .ANY selector match Section"的解决办法
- 解决 No mapping found for HTTP request with URI的方法
- NSRunloop,runloop,autoReleasePool和thread的关系理解及案例解决
- 如何解决XML文件中的警告提示“No grammar constraints (DTD or XML Schema) referenced in the document.” .
- An asset is marked with HideFlags.DontSave but is included in the build 解决方法