Re: [問題] 關於retain

看板MacDev作者 (白毛)時間11年前 (2014/01/16 20:15), 編輯推噓1(103)
留言4則, 2人參與, 最新討論串2/2 (看更多)
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)

01/18 15:22, , 1F
好難看懂這些明白@@ 讀讀看,感恩
01/18 15:22, 1F

01/18 22:15, , 2F
簡單來說就是自己的retain/release有寫好就好
01/18 22:15, 2F

01/18 22:16, , 3F
不要管retainCount回給你的值是多少
01/18 22:16, 3F

01/18 22:17, , 4F
因為iOS自己會為了優化或者其它原因而retain你的object
01/18 22:17, 4F
文章代碼(AID): #1Iryr5eB (MacDev)
討論串 (同標題文章)
本文引述了以下文章的的內容:
2
2
完整討論串 (本文為第 2 之 2 篇):
2
2
文章代碼(AID): #1Iryr5eB (MacDev)