Re: NSMutableData and Pinned Memory buffers..

2012-12-14 Thread Mike Abdullah
Arguably, you'd be better off subclassing NSData directly to add the mutation APIs that you actually need. That clears up any possible confusion about methods which might affect the length of the data. On 14 Dec 2012, at 00:13, Robert Monaghan wrote: Thanks for the suggestion, Kevin! I

NSMutableData and Pinned Memory buffers..

2012-12-13 Thread Robert Monaghan
Hi Everyone, I have just run head long into an issue with NSMutableData and existing buffers. I have the following code: UInt8 *sourcebytes = [clImgEngine srcBuffer]; [self setData:[NSMutableData dataWithBytesNoCopy:sourcebytes

Re: NSMutableData and Pinned Memory buffers..

2012-12-13 Thread Kevin Perry
NSMutableData currently ignores (and always has, to my knowledge) the no-copy hint and always copies the bytes into an internal buffer in case something tries to change the length of the NSMutableData. It would not be too difficult to make a subclass of NSMutableData that doesn't copy and

Re: NSMutableData and Pinned Memory buffers..

2012-12-13 Thread Robert Monaghan
Thanks for the suggestion, Kevin! I went ahead and created a really crude subclass of NSMutableData. It seems to work for my situation. Attached is the code, for posterity. (I am sure I won't be the only one working around this.) Any suggestions to make this a bit more Proper are welcome.

Re: NSMutableData and Pinned Memory buffers..

2012-12-13 Thread Greg Parker
On Dec 13, 2012, at 4:13 PM, Robert Monaghan b...@gluetools.com wrote: I went ahead and created a really crude subclass of NSMutableData. It seems to work for my situation. Attached is the code, for posterity. (I am sure I won't be the only one working around this.) Any suggestions to

Re: NSMutableData and Pinned Memory buffers..

2012-12-13 Thread Kevin Perry
On Dec 13, 2012, at 4:24 PM, Greg Parker gpar...@apple.com wrote: On Dec 13, 2012, at 4:13 PM, Robert Monaghan b...@gluetools.com wrote: I went ahead and created a really crude subclass of NSMutableData. It seems to work for my situation. Attached is the code, for posterity. (I am sure I

Re: NSMutableData and Pinned Memory buffers..

2012-12-13 Thread Melissa J Turner
On Dec 13, 2012, at 4:28 PM, Kevin Perry kpe...@apple.com wrote: On Dec 13, 2012, at 4:24 PM, Greg Parker gpar...@apple.com wrote: On Dec 13, 2012, at 4:13 PM, Robert Monaghan b...@gluetools.com wrote: I went ahead and created a really crude subclass of NSMutableData. It seems to work

Re: NSMutableData and Pinned Memory buffers..

2012-12-13 Thread Gwynne Raskind
On Dec 13, 2012, at 7:28 PM, Kevin Perry kpe...@apple.com wrote: On Dec 13, 2012, at 4:24 PM, Greg Parker gpar...@apple.com wrote: On Dec 13, 2012, at 4:13 PM, Robert Monaghan b...@gluetools.com wrote: I went ahead and created a really crude subclass of NSMutableData. It seems to work for my