> The documentation of -[NSData initWithBytesNoCopy:length:freeWhenDone:] and 
> of -[NSString initWithBytesNoCopy:length:encoding:freeWhenDone:] is unclear 
> about the case where freeWhenDone is NO. The data/string object then does not 
> take ownership of the memory buffer, so the question is: How long is the 
> caller obligated to keep the buffer intact?
>
> The two possible answers seem to be
> (a) until the caller releases the NSString object, or
> (b) forever, until the process exits (i.e. only ever use this on constant 
> buffers)

The buffer needs to remain intact until the NSString/NSData object is
deallocated.

_______________________________________________

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

Reply via email to