Re: mutableBytes Creates Autoreleased Objects
Re: mutableBytes Creates Autoreleased Objects
- Subject: Re: mutableBytes Creates Autoreleased Objects
- From: Dave Fernandes <email@hidden>
- Date: Sat, 12 May 2012 16:55:58 -0400
On 2012-05-12, at 12:37 PM, Quincey Morris wrote:
> P.S. I think there's also another, better solution, but it involves adding a method to NSData/NSMutableData via a category:
>
> - (void*) interiorBytes __attribute__ ((objc_returns_inner_pointer)) {
> return self.bytes;
> }
>
> - (void*) mutableInteriorBytes __attribute__ ((objc_returns_inner_pointer)) {
> return self.mutableBytes;
> }
>
> and never using bytes/mutableBytes directly ever again. Perhaps one day bytes/mutableBytes will themselves be marked this way.
So when a method is declared __attribute__ ((objc_returns_inner_pointer)), then LLVM tracks regular pointers like it would NSObject pointers to see when the owning object can be dealloced? Just want to make sure I understand.
Dave
_______________________________________________
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