• 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: Class gets EXC_BAD_ACCESS only as NSOperation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Class gets EXC_BAD_ACCESS only as NSOperation


  • Subject: Re: Class gets EXC_BAD_ACCESS only as NSOperation
  • From: James Maxwell <email@hidden>
  • Date: Tue, 24 Mar 2009 09:49:54 -0700

Ah, thanks. That makes sense, and it seems to be correct - I am processing ***lots*** of data.

I just tried making the float arrays into instance variables, wrapped in NSData objects, and it still crashes, only a little later than before.
What's the best way of getting these arrays off the stack? I've got several thousand of them to get through!


thanks for your help.

J.


On 24-Mar-09, at 9:04 AM, Bill Bumgarner wrote:

On Mar 24, 2009, at 8:22 AM, James Maxwell wrote:
	int sliceCount = [pitchSlices count];

	float midiEventsToHTM[sliceCount][20];
	float rhythmEventsToHTM[sliceCount][20];
....

The rhythmEventsToHTM array is the one that's getting the bad access error, and I can NSLog the rhythmSlices NSArray without issue. The other thing that seems very weird is that, if I just run the midiEventsToHTM data (i.e., commenting out anything to do with "rhythm") it runs fine in ... the NSOperation thread.

How big is sliceCount?

Threads typically have pretty darned small stack limits. The two float arrays above are both allocated on the stack. Thus, you are reserving (sliceCount * 20 * sizeof(float) * 2) bytes worth of space on the stack.

That the crash goes away when you only run w/one array and that the crash happens always on accessing the second array for the first time in the loop indicates that this is quite likely the case.

In general, creating really large buffers on the stack is risky. Move the arrays to the heap and the problem will quite likely be fixed.

b.bum

_______________________________________________

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: Class gets EXC_BAD_ACCESS only as NSOperation
      • From: Bill Bumgarner <email@hidden>
    • Re: Class gets EXC_BAD_ACCESS only as NSOperation
      • From: James Maxwell <email@hidden>
References: 
 >Class gets EXC_BAD_ACCESS only as NSOperation (From: James Maxwell <email@hidden>)
 >Re: Class gets EXC_BAD_ACCESS only as NSOperation (From: Bill Bumgarner <email@hidden>)
 >Re: Class gets EXC_BAD_ACCESS only as NSOperation (From: James Maxwell <email@hidden>)
 >Re: Class gets EXC_BAD_ACCESS only as NSOperation (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: Re: Key path for values in "Shared User Defaults"? [SOLVED]
  • Next by Date: Re: Class gets EXC_BAD_ACCESS only as NSOperation
  • Previous by thread: Re: Class gets EXC_BAD_ACCESS only as NSOperation
  • Next by thread: Re: Class gets EXC_BAD_ACCESS only as NSOperation
  • Index(es):
    • Date
    • Thread