title: Set to nil in viewDidUnload, but release in dealloc
body: <p>I've been reading all day about why views should be set to nil in viewDidUnload and released in dealloc. All the articles keep on repeating the same thing. Yes, I know the behind-the-scene instructions are different, but what are the practical differences? </p>
  
  <p><strong>var = nil</strong></p>
  
  <ol>
  <li>If var is a retained propery, reclaim memory the old object var pointed to.</li>
  <li>Set var to nil. </li>
  </ol>
  
  <p><strong>[var release]</strong></p>
  
  <ol>
  <li>Reclaim memory var points to.</li>
  <li>var now points to nothing, which is equivalent to nil</li>
  </ol>
  
  <p>To me, both ways of reclaiming memory have the same end result. So why do one over the other? Every book out there tells me to set to nil in <code>viewDidUnload</code> and release in <code>dealloc</code>. Someone should point out the bad things that would happen if a view was released in <code>viewDidUnload</code> and nilled in <code>dealloc</code>. </p>
  
  <p><strong>.h</strong></p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  @interface DisclosureDetailController : UIViewController {
   UILabel* label;
  }
  @property (nonatomic, retain) IBOutlet UILabel* label;
  @end
  </code></pre>
  
  <p><strong>.m</strong></p>
  
  <pre><code>#import "DisclosureDetailController.h"
  @implementation DisclosureDetailController
  @synthesize label;
  - (void)viewDidUnload {
   self.label = nil;
   // OR [self.label release];
   [super viewDidUnload];
  }
  - (void)dealloc {
   [self.label release];
   // OR self.label = nil;
  }
  </code></pre>