开发者

How to determine object's owner in Objective-C program?

Are there any tools availabl开发者_StackOverflowe as part of XCode4 that per given object will tell you "who owns it at any time?"


Yes. The Allocaitons instrument can answer that. Turn on retain count tracking and run your app. You can then click through any object (you'll typically only want to track live allocations) and see an inventory of all retains/releases related to that object.

All retains not balanced by a release from the same object indicates an ownership relationship.

It isn't 100% precise, but it works well enough (and is improving with each release).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜