If thread A sends a reference to an object to thread B, for example using performSelector:onThread:withObject:waitUntilDone
, how should memory management occur? Should the calling thread alloc
the object and the called thread release
it?
EDIT:
It turns out that performSelector:onThread:withObject:waitUntilDone
retains the object until the selector, which will be called on the other thread's run loop, is done with it. So the calling thread should alloc, then call performSelector, then release.