首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Iphone >

OC内存管理引用计数的有关问题

2013-07-16 
OC内存管理引用计数的问题新创建的对象引用计数应该是1吧,但是这个为什么不是XCode 4.6.2内存管理[解决办

OC内存管理引用计数的问题
新创建的对象引用计数应该是1吧,但是这个为什么不是
XCode 4.6.2

                                                  内存管理                                              
[解决办法]
Typically there should be no reason to explicitly ask an object what its retain count is (see retainCount). The result is often misleading, as you may be unaware of what framework objects have retained an object in which you are interested. In debugging memory management issues, you should be concerned only with ensuring that your code adheres to the ownership rules.


原文:http://stackoverflow.com/questions/2640568/objectivec-how-to-get-the-reference-count-of-an-nsobject
翻译:通 常我们没有必要去特地查询一个对象的retain count是多少。查询的结果常常会出乎意料。你不清楚framework里面的其他对象对你感兴趣的这个对象进行了多少retain操作。在debug 内存管理的问题时候,你只要关注保证你的代码符合所有者规则即可。(译者:我觉得应该是谁申请(几次)谁释放(几次)原则)

热点排行