作者whitefur (白毛)
看板MacDev
标题Re: [问题] 关於retain
时间Thu Jan 16 20:14:58 2014
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://0rz.tw/pXLIb
请拉到最下面
这篇也可以看看
http://stackoverflow.com/questions/8863269/how-do-i-verify-reference-count-in-arc-mode
※ 引述《santaclub (圣诞青年)》之铭言:
: 各位好
: 最近又遇到一个困难...
: 一个该死的property一直没有被删除 纵使看起来应该是没有retain count了
: 现在只知道 (CFGetRetainCount((__bridge CFTypeRef) something)
: 可以读到something 的retain count,
: 请问有没有办法可以看他的retain count到底是谁给的?
: 有请高人指点 ....感恩
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 111.240.130.108
※ 编辑: whitefur 来自: 111.240.130.108 (01/16 20:21)
1F:推 santaclub:好难看懂这些明白@@ 读读看,感恩 01/18 15:22
2F:→ whitefur:简单来说就是自己的retain/release有写好就好 01/18 22:15
3F:→ whitefur:不要管retainCount回给你的值是多少 01/18 22:16
4F:→ whitefur:因为iOS自己会为了优化或者其它原因而retain你的object 01/18 22:17