作者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)
推 santaclub:好難看懂這些明白@@ 讀讀看,感恩 01/18 15:22
→ whitefur:簡單來說就是自己的retain/release有寫好就好 01/18 22:15
→ whitefur:不要管retainCount回給你的值是多少 01/18 22:16
→ whitefur:因為iOS自己會為了優化或者其它原因而retain你的object 01/18 22:17