Fwd: [Biococoa-dev] NSMutableData vs malloc

Charles Parnot charles.parnot at gmail.com
Tue Jul 5 18:36:19 EDT 2005

On Jul 5, 2005, at 10:43 AM, John Timmer wrote:

>> So, ready to move on :-) ?
> If we are, it would seem to me that the next big step would be to  
> change the
> internal representation of the sequences to a char array, and then  
> write the
> bridging code to generate object representations on the fly.  I  
> don't trust
> my malloc capabilities enough to volunteer for the former, but I'll  
> happily
> help on the latter.

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].


NB: sorry, John,  I also sent you by mistake a half-baked version of  
that email!

Help science move fast forward:

Charles Parnot
charles.parnot at gmail.com

More information about the Biococoa-dev mailing list