> Can you not track the capacity yourself? Unless I'm missing something, if you > use > > +dataWithCapacity:some_capacity
The docs note that this doesn't necessarily pre-allocate the given capacity. You can test that trivially by asking for a capacity of several gigabytes. In a nutshell, there's no way to "lock" the underlying bytes of NSMutableData (or NSMutableString, or anything else like them). If you mutate them via method calls, you need to reset any interior pointers you may have. Strictly speaking you should reset your interior pointers every time you invoke any method on them, since they're technically free to re-arrange their internals however they like, even for what are [externally] non-mutating methods. If there's a performance concern, using IMP caching. The cost of the function call to retrieve the bytes pointer is really trivial. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com