Re: NSOperationQueue broken?
Re: NSOperationQueue broken?
- Subject: Re: NSOperationQueue broken?
- From: Jamie Johnson <email@hidden>
- Date: Thu, 30 Oct 2008 15:04:43 -0700
Looks like you're hosing memory because the subsequent invocation
operations are being released prior to their completion as seen in
this call stack:
#0 0x00001a0c in -[MyOp dealloc] at NSOp-Test.m:27
#1 0x94fba20f in NSPopAutoreleasePool
#2 0x9504f3a8 in -[NSOperation start]
#3 0x00001ad6 in -[MyOp start] at NSOp-Test.m:39
As a guess the NSOperationQueue places the operation in an
autoreleasepool, not really retaining it itself. The nearest pool
happens to be constructed in NSOperation -start. Upon exit boom!
By reorganizing the problem you should be able to avoid this apparent
bug. As I understand it you have a task that can be broken down into a
serializable set of operations. Decompose the task into a Queue with N
+1 operations. Each of the N operations are configured with their
chunk of the data to process, the +1 is simply an operation whose
dependent upon the complete set of N and serves to trigger a
notification that the task is complete. If an ordering is required
configure the dependency appropriately.
To support canceling tell the queue to -cancelAllOperations.
Jamie
On Oct 30, 2008, at 11:51 AM, Michael Ash wrote:
On Thu, Oct 30, 2008 at 2:45 PM, Quincey Morris
<email@hidden> wrote:
On Oct 30, 2008, at 10:40, Michael Ash wrote:
[_queue addOperation:op];
Have you tried using performSelectorOnMainThread: to force
serializing of
the queuing? It might be an acceptable workaround, if it works.
I haven't, simply because this stuff is performance critical and
having it get blocked because the main thread is busy processing user
input is unacceptable. So alas, while that may get around whatever bug
I'm encountering, it's not a usable workaround for me.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden