How do I track what is retaining my object? I have an object that isn't delloc
-ing as expected when it is removed from a list. My suspicion is that something is incrementing the retain count, so I'd like to know how I can ideally create a place to break into the code anytime that object's retain count is incremented.
The best possible answer is to use Instruments; it'll track retains/releases all day long.
If desperate, override -retain to simply return [super retain];
. That'll give you a method you can conveniently set a breakpoint on. You could then use breakpoint commands to do something like:
bt
continue
That'll cause the debugger to spew the backtrace of every call, when hit, and then continue.