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];
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 <
> 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
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
> 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