Skip navigation.
 
mlRe: Accessing buffers in NSData/NSMutableData under garbage collection
FROM : Chris Suter
DATE : Tue Feb 19 19:38:51 2008

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

Related mailsAuthorDate
mlAccessing buffers in NSData/NSMutableData under garbage collection Rick Hoge Feb 18, 23:21
mlRe: Accessing buffers in NSData/NSMutableData under garbage collection Adam P Jenkins Feb 19, 06:00
mlRe: Accessing buffers in NSData/NSMutableData under garbage collection mmalc crawford Feb 19, 06:07
mlRe: Accessing buffers in NSData/NSMutableData under garbage collection Adam P Jenkins Feb 19, 06:19
mlRe: Accessing buffers in NSData/NSMutableData under garbage collection Adam P Jenkins Feb 19, 06:23
mlRe: Accessing buffers in NSData/NSMutableData under garbage collection Chris Suter Feb 19, 07:24
mlRe: Accessing buffers in NSData/NSMutableData under garbage collection Alastair Houghton Feb 19, 12:48
mlRe: Accessing buffers in NSData/NSMutableData under garbage collection Adam P Jenkins Feb 19, 15:26
mlRe: Accessing buffers in NSData/NSMutableData under garbage collection Alastair Houghton Feb 19, 15:46
mlRe: Accessing buffers in NSData/NSMutableData under garbage collection Quincey Morris Feb 19, 19:36
mlRe: Accessing buffers in NSData/NSMutableData under garbage collection Chris Suter Feb 19, 19:38
mlRe: Accessing buffers in NSData/NSMutableData under garbage collection Michael Ash Feb 19, 20:03
mlRe: Accessing buffers in NSData/NSMutableData under garbage collection Alastair Houghton Feb 19, 20:28
mlRe: Accessing buffers in NSData/NSMutableData under garbage collection Quincey Morris Feb 19, 22:12
mlRe: Accessing buffers in NSData/NSMutableData under garbage collection Chris Suter Feb 19, 23:42
mlRe: Accessing buffers in NSData/NSMutableData under garbage collection Quincey Morris Feb 20, 00:35
mlRe: Accessing buffers in NSData/NSMutableData under garbage collection Michael Ash Feb 20, 00:44
mlRe: Accessing buffers in NSData/NSMutableData under garbage collection Chris Suter Feb 20, 00:59