On Sep 15, 2008, at 1:04 PM, Quincey Morris wrote:

On Sep 15, 2008, at 10:31, Jason Coco wrote:

You /should/, however, autorelease your NSOperation since your queue
will retain it when you add it and release it when it completes.

This sounds plausible, but I can't find anything in the documentation promising that NSOperationQueue will retain its NSOperation objects. (The sample code in the Threading Programming Guide does no memory management, so apparently leaks its NSInvocationOperation object.)

It's possible that it's not safe to release a NSOperation until after it returns YES to [NSOperation isFinished].

I don't think there needs to be anything specific in the documentation. In the absence of a documented exception, we should assume it follows the usual Cocoa memory management conventions. That is, if you need to continue to access the NSOperation, you need to hold ownership of it. If you don't care about accessing it in the future, you need not. The NSOperationQueue is expected to do whatever is necessary for it to carry out its responsibilities. If it needs to retain the NSOperation objects, and we can guess that it probably does need that, it will. You, as a client, shouldn't care though.

Cheers,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to