Re: Garbage Collection Docs Puzzle

2010-01-26 Thread John Engelhart
On Tue, Jan 26, 2010 at 4:51 PM, Sean McBride wrote: > On 1/25/10 4:49 PM, Robert Clair said: > > >The garbage collection docs section on the interior pointer issue shows > >this example: > > > >NSData *myData = [someObject getMyData]; > >[myData retain]; > >const uint8_t *bytes = [myData bytes];

Re: Garbage Collection Docs Puzzle

2010-01-26 Thread Sean McBride
On 1/25/10 4:49 PM, Robert Clair said: >The garbage collection docs section on the interior pointer issue shows >this example: > >NSData *myData = [someObject getMyData]; >[myData retain]; >const uint8_t *bytes = [myData bytes]; >NSUInteger offset = 0, length = [myData length]; > >while (offset <

Re: Garbage Collection Docs Puzzle

2010-01-25 Thread Robert Clair
> The issue being worked-around is that of the compiler; during > optimization, if you stop referencing myData, [snip] Yes. As I said, I understand the issue - my only question was whether the short-circuited retain was enough to do it. I didn't know whether the compiler did this or the runtime

Re: Garbage Collection Docs Puzzle

2010-01-25 Thread Julien Jalon
Except -retain is more efficient under GC. -- Julien from his iPhone Le 26 janv. 2010 à 00:06, Dave Keck a écrit : sending myData -self at the end of the method would make a lot more sense. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) P

Re: Garbage Collection Docs Puzzle

2010-01-25 Thread Dave Keck
> What's with the retain and release? I understand the issue of keeping myData > alive until you're finished with the interior pointer, but why [myData > release]?   Is the release enough to keep myData alive even thought its > dispatch is short circuited under GC? And the retain is there to bal