title: NSAutoreleasePool issues on the iPhone
body: <p>I have a small iPhone app which has a button on the first view. When I select this button I load up my new view which has an image on it. I'm currently using the following code to load the image from an online source on a separate thread, whilst allowing the user to continue controlling the application:</p>
  
  <pre><code>- (void) loadImageTest
  {
      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  
      NSURL *url = [[NSURL alloc] init];
      url = [NSURL URLWithString:logoPath];
  
      NSData *data = [[NSData alloc] init];
      data = [NSData dataWithContentsOfURL:url];
  
      loadingImage = [UIImage imageWithData:data];
      titleLogoImage.image = loadingImage;
  
      //[pool drain];
      [pool release];
  }
  </code></pre>
  
  <p>This is called from this line of code in the new view's init:</p>
  
  <pre><code>[NSThread detachNewThreadSelector:@selector(loadImageTest) toTarget:self withObject:nil];
  </code></pre>
  
  <p>Now this works fine (ish), but if I close the new view and then load a new one up again in quick succession (or just after-wards in some cases) it will bomb out with the classic EXC_BAD_ACCESS. I'm sure that this is due to the code within the thread pool, but can anyone see why this is happening?</p>
  
  <p>Thanks</p>