Re: Accessing buffers in NSData/NSMutableData under garbage collection
Re: Accessing buffers in NSData/NSMutableData under garbage collection
- Subject: Re: Accessing buffers in NSData/NSMutableData under garbage collection
- From: Chris Suter <email@hidden>
- Date: Wed, 20 Feb 2008 09:42:03 +1100
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
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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