On Sep 15, 2008, at 14:04 , 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.)

Good point. It currently retains them and then releases them when they're finished, but the documentation doesn't guarantee anything about memory management and the example definitely looks like it leaks. I filed an enhancement request for the documentation at rdar://6220597 so hopefully someone will adjust it to let us know what to do. I guess for now it's safer to actively manage the NSOperation object and not release it until it returns YES (as you indicated
below).

J

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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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