• 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: GC crash due to being naughty
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GC crash due to being naughty


  • Subject: Re: GC crash due to being naughty
  • From: Ben Haller <email@hidden>
  • Date: Thu, 15 Oct 2009 20:09:41 -0400

I'd start by taking a look at the CHDataStructures framework:  http://cocoaheads.byu.edu/wiki/chdatastructures

It's a framework hosted by our local CocoaHeads group that includes most of the data structures that Apple forgot. =)

An interesting framework, looks useful. Looking at the CHAbstractCircularBufferCollection class, I don't see it doing any special GC-related dance. The only substantial differences between it and what I am doing are that:


- I use malloc to make my array of pointers to objects, and it uses NSAllocateCollectable with NSScannedOption

- I declare my pointer as "AKIndividual **individuals" and it uses "__strong id *array"

So perhaps those choices avoid the issue, by avoiding the caveat "You should never take the address of a weak global, static or instance variable, as assigning or reading through that pointer will bypass the weak barriers and expose your programs to race conditions." But then as Greg Parker said, references stored in a malloced block are neither weak nor strong, they are just dangling pointers. So I don't really understand why I'm getting bitten in the first place. Dangling pointers is exactly what I want; why is auto_zone_root_write_barrier() getting into the middle of my assignment loop in the first place?

Ben Haller
Stick Software

_______________________________________________

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


References: 
 >GC crash due to being naughty (From: Ben Haller <email@hidden>)
 >Re: GC crash due to being naughty (From: Greg Parker <email@hidden>)
 >Re: GC crash due to being naughty (From: Ben Haller <email@hidden>)
 >Re: GC crash due to being naughty (From: Dave DeLong <email@hidden>)

  • Prev by Date: Re: How to switch the default printer?
  • Next by Date: Re: GC crash due to being naughty
  • Previous by thread: Re: GC crash due to being naughty
  • Next by thread: Re: GC crash due to being naughty
  • Index(es):
    • Date
    • Thread