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                 s...@rogue-research.com
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to