I have a thread that modifies a passed pointer to an object (which is alloc'd and retained in the calling thread) in a loop. If I put the pointer in the autorelease pool, I sometimes get errors because the object is being released when it shouldn't. I took it out of the autorelease pool and this seems to work. However, I am worried about a memory leak because if I don't use an autorelease pool at all, I get a severe leak.
-(void)my_thread:(NSArray*)parameters;
{
//keep this out of the autorelease pool
Object *theObject;
[[parameters objectAtIndex:2] getValue:&theObject];
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
//do stuff to theObject
[pool release];
}