Re: Unclear on -initWithBytesNoCopy:
Re: Unclear on -initWithBytesNoCopy:
- Subject: Re: Unclear on -initWithBytesNoCopy:
- From: Dave Keck <email@hidden>
- Date: Sat, 03 Mar 2012 14:28:29 -0500
> 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 (email@hidden)
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:
This email sent to email@hidden