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 05:38:51 +1100
On 19/02/2008, at 10:48 PM, Alastair Houghton wrote:
I'm not sure what the best fix is for this. Like Chris said, one
option would be to allow us to allocate "autoreleased" memory (in
which case -UTF8String should probably be doing that too). Or maybe
the GC should support interior pointers to memory allocated with
NSAllocateCollectable()?
I'm not convinced that supporting interior pointers is the right
solution. I can imagine a situation where the pointer that's lying
around is pointing beyond the end of the array. For example, with
optimisations this might break:
for (n = 0, myPointer = myArray; n < size; ++n, ++myPointer) {
// Do something
}
// In the following the compiler could optimise this to be myPointer[-1]
doSomethingWith (myArray[size - 1]);
// No further references to myArray
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