• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: crash on altering NSMutableArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: crash on altering NSMutableArray


  • Subject: Re: crash on altering NSMutableArray
  • From: Kyle Sluder <email@hidden>
  • Date: Sat, 1 May 2010 17:17:00 -0700

On May 1, 2010, at 5:04 PM, James Maxwell <email@hidden> wrote:

I'm having a crash when trying to remove the last item in an NSMutableArray.
The app is a pretty complex system, and runs its two main processes in consecutively executed blocks.
The blocks are run using dispatch_apply, on the global queue. The operation that's trying to
access the NSArray is, I think, within the first block... but honestly, I can't be totally sure, as
I don't know exactly why the app is crashing.

Yes you do. You have a debugger and a stack trace.

I guess what I'm wondering is whether there's some fool-proof way of protecting that NSArray from being read and changed simultaneously?
I tried making the array nonatomic, but that didn't solve the problem.
Of note is the fact that this is directly related to processing load, so I'm assuming it has to do
with some timing thing -- as the app gets more loaded down, things get sketchy.

The concept you're looking for is thread safety. It is, in general, a Very Hard Problem.



I know this isn't a great description of the problem, but hopefully someone has some thoughts to share.

If you have a crash, the only two useful pieces of information are the source code and the stack trace. Anything else risks misinterpretation and therefore wasted time.


--Kyle Sluder
_______________________________________________

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


  • Follow-Ups:
    • Re: crash on altering NSMutableArray
      • From: James Maxwell <email@hidden>
References: 
 >crash on altering NSMutableArray (From: James Maxwell <email@hidden>)

  • Prev by Date: crash on altering NSMutableArray
  • Next by Date: Re: crash on altering NSMutableArray
  • Previous by thread: crash on altering NSMutableArray
  • Next by thread: Re: crash on altering NSMutableArray
  • Index(es):
    • Date
    • Thread