Re: Transitioning to GC-supported
Re: Transitioning to GC-supported
- Subject: Re: Transitioning to GC-supported
- From: "Sean McBride" <email@hidden>
- Date: Tue, 27 Oct 2009 11:44:20 -0400
- Organization: Rogue Research Inc.
On 10/26/09 8:38 AM, Jens Alfke said:
>> 1. Apply workaround for interior pointers by '[containingObject
>> self];' at
>> the end of the method, to keep the containing object alive.
>
>A valid point, but in my experience this is a rare problem: I have
>never run into an instance of a bug caused by interior pointers.
That entirely depends on one's code and what's it's doing. If you are,
say, doing some pixel-processing on NSData-based data then you'll be
using -bytes a lot, and need to be careful. I _have_ been hit by these
bugs, and they are a pain.
Methods to watch out for: bytes, mutableBytes, UTF8String, cString,
fileSystemRepresentation, bitmapData, etc.
The 10.6 release notes mention that the implementation of some of these
has changed to eliminate this problem (presumably by returning a GC-
memory copy), so remember to test on 10.5 too (if you support it).
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
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