title: iOS autoreleased with no pool in place - but I am creating ARP!
body: <p>So, I am using [NSThread detachNewThreadSelector] to spawn a new thread and I am getting "autoreleased with no pool in place " errors in the console. I know this can happen if you fail to create an auto release pool, but the thing is, I am creating one. I use similar code in other parts of the same app and do NOT get these errors.</p>
  
  <p>Here is the relevant code: </p>
  
  <pre><code>- (void) startThread:(NSString*)strURL
  {
      // start new thread to load image
      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
      [NSThread detachNewThreadSelector:@selector(loadImageFromURL:) toTarget:self withObject:strURL];
      [pool release];
  }
  
  - (void) loadImageFromURL:(NSString*)strURL
  {
      NSNumber* nn = [NSNumber numberWithInt:self.tag];
      NSLog(@"loadURL: Tag number == %i", [nn intValue]);
  
     // other code here actually does the work
  }
  </code></pre>
  
  <p>Now, there was more code in loadImageFromURL which actually does the work (of loading an image from a remote server) - but the problem manifests itself without that code, so I've removed it (just so you don't think I have a pointless thread which does nothing!). I left in just one line of code which demonstrates the problem - it creates an autoreleased NSNumber object.</p>
  
  <p>When this code runs, it reports this to the console:</p>
  
  <p><code>__NSAutoreleaseNoPool(): Object 0x535c0e0 of class NSCFNumber autoreleased with no pool in place - just leaking</code></p>
  
  <p>Of course, the real code creates many other AR objects and all of them get reported as well.</p>
  
  <p>Would be grateful for any tips or pointers which might help! </p>
  
  <p>Thanks! </p>