I have some problems with memory leaks on iPhone (imagine that), and I have a custom object with a retain count of 10.
Is there any way I can know what code triggered the retain count increased for a specific object instance? I am using GHUnit if that matters.
The leaks tool (one of the "instruments" in XCode) is able to analyse that sort of thing, but I don't think you can do it programatically.
Here is a great tutorial: http://mobileorchard.com/find-iphone-memory-leaks-a-leaks-tool-tutorial/
(Update to summarise comments): If you'd like to set a breakpoint in the retain method (to look at the stack trace) you can override the retain method.