title: Is there a way to "find mystery retains" ...?
body: <p>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.</p>
  
  <p>I carefully looked through the big class and eventually found the various things that needed to be released.</p>
  
  <p>This got me thinking: <strong>there just has to be some really easy way to "find" all the retains on an object</strong> .. am I right?</p>
  
  <p>So, is there a simple way to <strong>"find all the retains"</strong> on an object?  Is there a button in XCode or Instruments that everyone else knows about?</p>
  
  <p>What do you do when you can't find a mystery retain like that?</p>
  
  <p>So in the iOS universe, if anyone knows the <strong>"Show where all the retains came from on this object"</strong> button -- thanks!</p>
  
  <p><strong>P.S. Note that there is no leak, and this question is totally unrelated to leaks.</strong> The object simply "perfectly correctly" wouldn't release.</p>
  
  <hr>
  
  <p>Later ..</p>
  
  <h1>Truly astounding solution by Fabio:</h1>
  
  <p>Fabio has provided an astounding solution to this problem.  In nine words, here it is:</p>
  
  <pre><code>-(id)retain
      {
      NSLog(@"%@", [NSThread callStackSymbols]);
      return ([super retain]);
      }
  </code></pre>
  
  <p>That is amazingly useful in many situations and leads to many other useful things. You've probably saved me two man-weeks of work per annum forever, Fabio. Thanks!</p>
  
  <p>BTW if you're just getting to grips with this and struggling with the output, I saw that typically there will be many chunks featuring "UINib instantiateWithOwner:". It looks like those will come first, the significant chunks will follow.</p>