FROM : Chris Suter
DATE : Tue Feb 19 23:42:03 2008
On 20/02/2008, at 8:12 AM, Quincey Morris wrote:
> which means there are 3 possible avenues for dealing with this case
> of optimization fragility, not just the 2 you mentioned:
>
> 1. Enhance GC (code generation and runtime) to work with interior
> pointers.
I'm not convinced this would work. See earlier e-mail.
> 2. Be careful not to let the non-interior pointer variable's
> lifetime expire before you're done with the interior pointer.
This is little better than using malloc and free.
> and
>
> 3. Enhance Objective-C -- to warn about or disallow certain patterns
> of interior pointer usage, say, or to generate code that preserves
> the base pointer reference when pointer arithmetic is used.
This won't work for libraries that you have no control over. For
example, you might pass -[NSString UTF8String] to other library
routines that aren't Objective C and have no knowledge of garbage
collection (which is a fairly common usage pattern).
The only solution that I can see is viable is the one I proposed—use
autoreleased memory for these kinds of temporary objects.
- Chris
DATE : Tue Feb 19 23:42:03 2008
On 20/02/2008, at 8:12 AM, Quincey Morris wrote:
> which means there are 3 possible avenues for dealing with this case
> of optimization fragility, not just the 2 you mentioned:
>
> 1. Enhance GC (code generation and runtime) to work with interior
> pointers.
I'm not convinced this would work. See earlier e-mail.
> 2. Be careful not to let the non-interior pointer variable's
> lifetime expire before you're done with the interior pointer.
This is little better than using malloc and free.
> and
>
> 3. Enhance Objective-C -- to warn about or disallow certain patterns
> of interior pointer usage, say, or to generate code that preserves
> the base pointer reference when pointer arithmetic is used.
This won't work for libraries that you have no control over. For
example, you might pass -[NSString UTF8String] to other library
routines that aren't Objective C and have no knowledge of garbage
collection (which is a fairly common usage pattern).
The only solution that I can see is viable is the one I proposed—use
autoreleased memory for these kinds of temporary objects.
- Chris






Cocoa mail archive

