Re: Newbie question: how to release an object that has been autoreleased
Re: Newbie question: how to release an object that has been autoreleased
- Subject: Re: Newbie question: how to release an object that has been autoreleased
- From: Frederick Cheung <email@hidden>
- Date: Wed, 22 Sep 2004 20:36:47 +0200
On 22 Sep 2004, at 20:28, Ondra Cada wrote:
John,
On 22.9.2004, at 19:48, John Mikros wrote:
If these buffer objects are being passed between threads then I'd
imagine that you'd want to avoid autorelease like the plague.
Nope. Why, on earth?
You don't want the object autoreleased while you're still using it in
the other thread.
Why? That does not make real sense. Autorelease is just a delayed
release.
If the object is used in another thread, it is bound to be retained
there (and eventually /auto/released there). Thus, no harm in in being
autoreleased in the first thread, for it won't be deallocated (until
it is /auto/released in all the threads in which it is used).
You don't know that the delayed release will happen after the other
thread has run and retained the object whereas in a non threaded world
you are usually sure that the delayed release occurs after whoever is
using the object has either finished with it or has retained it.
Fred
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden