[Biococoa-dev] NSMutableData vs malloc

Charles Parnot charles.parnot at gmail.com
Tue Jul 5 18:57:45 EDT 2005


>>
>> This is why I was leaning towards NSData. Actually, the real  
>> benefit is with NSMutableData. Mallocing an array of char like  
>> NSData would is trivial, but dealing with resizing is more  
>> difficult. NSMutableData does it for us and deals with memory  
>> issues. In addition, because it is a class cluster (sorry, the c  
>> word!), it might be (or will be) optimized for different sizes of  
>> data. Also, it is easy to write/read files, but also send data  
>> over the network... Finally, it is Core Data compatible. The  
>> bottom line is: if we malloc our own char[], we might end up  
>> creating NSData object anyway. Getting the pointer to the array of  
>> bytes is trivial: [myData bytes] or [myData mutableBytes].
>>
>>
>
> But I guess for the data operations we will still need the nitty  
> gritty C calls, including friendly stringpointers.
>
> - Koen.

Yes, but this very friendly, right?

e.g. stringSequence[190]

This is (almost) as friendly as perl ;-)

charles


--
Xgrid-at-Stanford
Help science move fast forward:
http://cmgm.stanford.edu/~cparnot/xgrid-stanford

Charles Parnot
charles.parnot at gmail.com






More information about the Biococoa-dev mailing list