新建线程中run loop的autorelease池
来源:互联网 发布:电信首选网络类型 编辑:程序博客网 时间:2024/06/04 00:28
“我们每个新建的线程都会有一个默认的run loop,当这个线程被创建之后,会自动生成一个autorelease池,这个池会在run loop结束时释放,这个池是系统生成,我们无法操控,所以不进行其他retain或者copy操作的话,在线程中自动释放的对象的只存在于该线程本身,而ios这样的设计也很符合逻辑”
完全是骗人的,如果我们自己不创建autorelease pool的话,如果线程中有自动释放的对象,log中会打印类似
TestNSTimerRunloop[3663:5d03] *** __NSAutoreleaseNoPool(): Object 0x4b23760 of class __NSDate autoreleased with no pool in place - just leakingTestNSTimerRunloop[3663:5d03] *** __NSAutoreleaseNoPool(): Object 0x8a02560 of class __NSCFTimer autoreleased with no pool in place - just leakingTestNSTimerRunloop[3663:5d03] *** __NSAutoreleaseNoPool(): Object 0x4b237a0 of class __NSArrayI autoreleased with no pool in place - just leaking
所以说在网上看到某些文章后一定要亲自试一下,不是所有的都是正确的
- 新建线程中run loop的autorelease池
- 线程与run loop
- iOS中Run Loop的那些坑
- iOS 中Run Loop的理解(1)
- ios 中 Run Loop 总结
- 走进Run Loop的世界 (一):什么是Run Loop?
- 走进Run Loop的世界 (一):什么是Run Loop?
- 走进Run Loop的世界 (一):什么是Run Loop?
- 走进Run Loop的世界 (一):什么是Run Loop?
- 走进Run Loop的世界 (一):什么是Run Loop?
- iOS run loop(NSRunLoop)和线程的一些需要注意的细节
- Run Loop
- Run Loop
- Run Loop
- Run Loop
- Run Loop
- Run Loop
- run loop
- 剖析Linux系统启动过程
- 文本框_变下划线 (多行文本变下划线)
- 今天在Delphi中使用ADO连接Excel
- 引用 ubuntu中查看各种设备和资源的命令汇总
- php面向对象
- 新建线程中run loop的autorelease池
- 以服务为中心的网络之web service
- 黑马程序员_JavaBean
- $(EFI_SOURCE)
- AWT窗体
- 面向对象的简单介绍
- 开机加速——在注册表里禁止开机自检硬盘
- mysql中split函数
- BTree,B-Tree,B+Tree,B*Tree