What is the best way to find out who pushed keepCount to 3?
This approaches the problem from the wrong angle. This will confuse you and lead you astray (and probably the direct past), the actual problem when it really is.
It is better to think about who owns the object. Do you intend to save the object as the value of one of your own properties? If so, then you are one of its owners. If not, then this is not so. If you transfer an object to another object for storage in one of its properties, then this other object is also the owner.
These owners are just relationships, so itβs very easy to keep them right in your head.
- "This is one of my controllers. It owns the root objects of my model and one or more [controller] s views."
- "This is a view. He owns some parts of my model."
- "This is part of my model. It owns only primitive objects."
- "This is another part of my model. It owns some primitive objects and some other bits of the model."
If you have a complete understanding of your owners, you cannot write a memory leak, except that you forget the release or autorelease (which can happen to anyone), and you almost certainly will not write circular save (two objects save each other ), with the exception of knowingly and with plentiful comments and #warnings.
If you did not develop your owners, then you probably wrote one or more memory leaks or cyclic holds that you are not aware of.
Edit: And in order to answer the actual question, the best way to find out what is preserved and, possibly, subsequently auto-implement, is to use the Tool Selection Tools tool . With it, you can view the history of any object to see each distribution, save, auto-detect, release and release its address.
source share