When to use -retainCount?

前端 未结 11 1357
借酒劲吻你
借酒劲吻你 2020-11-21 06:49

I would like to know in what situation did you use -retainCount so far, and eventually the problems that can happen using it.

Thanks.

11条回答
  •  暖寄归人
    2020-11-21 07:12

    Take a look at the Apple documentation on NSObject, it pretty much covers your question: NSObject retainCount

    In short, retainCount is probably useless to you unless you've implemented your own reference counting system (and I can almost guarantee you won't have).

    In Apple's own words, retainCount is "typically of no value in debugging memory management issues".

提交回复
热议问题