On Mar 25, 2006, at 7:12 PM, John Draper wrote: But am I supposed to wrap this above code in the C++ threads?
Yep -- if your C++ threads do anything at all Cocoa-ish, then you need to set up the an autorelease pool. If so, what part of the thread? The part that gets called repeatedly, or the part the initializes the thread... It depends. If your thread starts up, and loops indefinitely (in some kind of CFRunLoop/NSRunLoop, right ;-), you will need to put the autorelease pool in the loop. If, on the other hand, the thread is started, does some work, then quits, it might suffice to put the autorelease pool in the thread's invocation routine.
Also, anytime the system calls back into your code, you should set up an autorelease pool -- this applies not only to thread invocations, but for run loop and timer callbacks.
joe
|