Re: GC crash due to being naughty

2009-10-16 Thread Kirk Kerekes
... This led me to generate a new hypothesis: that I am an idiot. I have now proven that hypothesis to my full satisfaction. ... A remarkably universal observation. I certainly have made it many times about myself. One of my rules of thumb about Cocoa coding is Code for your Inner

GC crash due to being naughty

2009-10-15 Thread Ben Haller
Hi all. I'm getting a crash in auto_zone_root_write_barrier() that I don't understand. I suspect it has to do with this little blurb in the Garbage Collection Programming Guide: Limitations on Mac OS X v10.5: You may pass addresses of strong globals or statics into routines expecting

Re: GC crash due to being naughty

2009-10-15 Thread Oftenwrong Soong
to cause nasty problems.) Soong - Original Message From: Ben Haller bhcocoa...@sticksoftware.com To: Cocoa List cocoa-dev@lists.apple.com Sent: Thu, October 15, 2009 3:54:11 PM Subject: GC crash due to being naughty Hi all. I'm getting a crash in auto_zone_root_write_barrier() that I

Re: GC crash due to being naughty

2009-10-15 Thread Ben Haller
Haller bhcocoa...@sticksoftware.com To: Cocoa List cocoa-dev@lists.apple.com Sent: Thu, October 15, 2009 3:54:11 PM Subject: GC crash due to being naughty Hi all. I'm getting a crash in auto_zone_root_write_barrier() that I don't understand. I suspect it has to do with this little blurb

Re: GC crash due to being naughty

2009-10-15 Thread Greg Parker
On Oct 15, 2009, at 3:54 PM, Ben Haller wrote: Hi all. I'm getting a crash in auto_zone_root_write_barrier() that I don't understand. I suspect it has to do with this little blurb in the Garbage Collection Programming Guide: Limitations on Mac OS X v10.5: You may pass addresses of

Re: GC crash due to being naughty

2009-10-15 Thread Ben Haller
On 15-Oct-09, at 7:30 PM, Greg Parker wrote: A pointer value stored in an ordinary malloc block is neither a strong nor a weak reference. It is a dangling pointer. It can be used safely, but requires great care because the garbage collector has no knowledge of what you're doing. The

Re: GC crash due to being naughty

2009-10-15 Thread Dave DeLong
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. =) Cheers, Dave On Oct 15, 2009, at 5:44 PM, Ben Haller wrote:

Re: GC crash due to being naughty

2009-10-15 Thread Ben Haller
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

Re: GC crash due to being naughty

2009-10-15 Thread Oftenwrong Soong
...@apple.com Cc: Cocoa List cocoa-dev@lists.apple.com Sent: Thu, October 15, 2009 4:44:23 PM Subject: Re: GC crash due to being naughty On 15-Oct-09, at 7:30 PM, Greg Parker wrote: A pointer value stored in an ordinary malloc block is neither a strong nor a weak reference. It is a dangling pointer

Re: GC crash due to being naughty

2009-10-15 Thread Ben Haller
On 15-Oct-09, at 8:10 PM, Oftenwrong Soong wrote: Hi Ben, You say the crash occurs in this line: individuals[individualCount++] = individualsForPop[i]; The problem may be in the post-increment (individualCount++). IIRC, there is no agreed-upon compiler standard as to whether the post-

Re: GC crash due to being naughty

2009-10-15 Thread Greg Parker
On Oct 15, 2009, at 4:44 PM, Ben Haller wrote: On 15-Oct-09, at 7:30 PM, Greg Parker wrote: A pointer value stored in an ordinary malloc block is neither a strong nor a weak reference. It is a dangling pointer. It can be used safely, but requires great care because the garbage collector

Re: GC crash due to being naughty

2009-10-15 Thread Ben Haller
On 15-Oct-09, at 8:26 PM, Greg Parker wrote: I don't see any global pointer variables involved. My guess is that `individuals` is uninitialized or NULL or `individuals[individualCount]` is out of bounds. The write barrier objc_assign_strongCast() does range checks on the destination

Re: GC crash due to being naughty

2009-10-15 Thread Clark S. Cox III
. I've had many a headache in the past with things like this!! Soong - Original Message From: Ben Haller bhcocoa...@sticksoftware.com To: Greg Parker gpar...@apple.com Cc: Cocoa List cocoa-dev@lists.apple.com Sent: Thu, October 15, 2009 4:44:23 PM Subject: Re: GC crash due to being naughty