On 8/8/09 5:45 PM, Eric Hermanson said:

>1. Is it more efficient to malloc a uint8_t array and call NSData
>'init no copy', rather than pass in an array allocated with a fixed
>length on the stack to the init method that makes a copy of the bytes?

More efficient according to which metric?  Memory usage?  CPU time?
Code readability?

If you ever want to support garbage collection, I suggest this usage:

- [NSMutableData dataWithCapacity:numBytes];
- mutableBytes to get pointer
- fill with your data

--
____________________________________________________________
Sean McBride, B. Eng                 [email protected]
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to