title: How does the NSAutoreleasePool autorelease pool work?
body: <p>As I understand it, anything created with an <strong>alloc</strong>, <strong>new</strong>, or <strong>copy</strong> needs to be manually released. For example:</p>
  
  <pre><code>int main(void) {
      NSString *string;
      string = [[NSString alloc] init];
      /* use the string */
      [string release];
  }
  </code></pre>
  
  <p>My question, though, is wouldn't this be just as valid?:</p>
  
  <pre><code>int main(void) {
      NSAutoreleasePool *pool;
      pool = [[NSAutoreleasePool alloc] init];
      NSString *string;
      string = [[[NSString alloc] init] autorelease];
      /* use the string */
      [pool drain];
  }
  </code></pre>