Re: Crash and dispatch queue
Re: Crash and dispatch queue
- Subject: Re: Crash and dispatch queue
- From: Dave Zarzycki <email@hidden>
- Date: Thu, 17 Nov 2011 15:14:44 -0500
James,
We need a lot more information before we can give any help. Please strongly consider reducing your experience down to a compilable test case.
Good luck,
davez
On Nov 17, 2011, at 1:49 PM, James Maxwell wrote:
> I have a method that's crashing with EXC_BAD_ACCESS. I'm running a fairly lengthy, iterative process in a distpatch_async block and at the end of it saving a file. Originally, I had included the file save in the block...
>
> dispatch_async(queue,^{
> [myObject doSomeHorrificCrunching];
> [myObject saveDataToFile];
> });
>
>
> ...and was getting a crash in certain situations -- it seemed to be related to the size of the file (which also indicates the length/complexity of the iterative process). So, I tried pulling the file save out of the block:
>
> dispatch_async(queue,^{
> [myObject doSomeHorrificCrunching];
> });
>
> [myObject saveDataToFile];
>
> This also crashed (which is not surprising). So, just to check my theory that perhaps the data was still being modified when the file save method was run, I used dispatch_sync:
>
> dispatch_sync(queue,^{
> [myObject doSomeHorrificCrunching];
> });
>
> [myObject saveDataToFile];
>
> This didn't crash, but of course I had to enjoy the glorious beach ball.
>
> So, finally, I tried using a group (and going back to dispatch_async)...
>
> dispatch_group_async(group, queue,^{
> [myObject doSomeHorrificCrunching];
> });
>
> dispatch_group_notify(group, queue, ^{
> [myObject saveDataToFile];
> });
>
> ...but to my dismay, the crash came back.
> I'm wondering: does this last step actually prove that my crash is _not_ being caused by trying to save while the data is being modified?
> Unfortunately, I haven't been able to get any info on the state of the object when the crash happens. I have Zombies enabled, but I don't get any zombie action in the console.
> Confused...
>
> J.
>
> ------------------------------------------------------
> James B. Maxwell
> Composer/Researcher/PhD Candidate
>
>
>
>
>
>
> _______________________________________________
>
> 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