Recently I was repairing someone\'s code. There was a big class that would not dealloc. You\'d have to hit it with 5 or 6 releases to get it to dealloc.
I carefully
Just guessing... but you may overwrite the retain method of the custom class calling super and throwing a nice NSLog to print the call stack.
-(id) retain {
NSLog(@"%@", [NSThread callStackSymbols]);
return ([super retain]);
}
Another important detail is that [NSThread callStackSymbols] returns a NSArray of NSStrings that can be filtered and used for other purposes. For example in complex and dynamic code, to check if a method properly causes another one to fire.
NOTE:
In an ARC environment you will need to first add the -fno-objc-arc to compiler flags to allow you to override retain and call super.