> On Feb 14, 2016, at 7:17 PM, Marcel Weiher <[email protected]> wrote:
>
>
>> On 11 Feb 2016, at 20:44, Dan Lau <[email protected]> wrote:
>>
>> If a file has its contents mapped using NSData's
>> initWithContentsOfFile + NSDataReadingMappedIfSafe,
>> deleting it doesn't appear to affect reading it's mapped contents. Does
>> anyone know if NSData uses mmap(2) under the hood to ensure that this sort
>> of operation is valid?
>
> [As Jens said: yes]
>
> In fact, file data will stick around as long as you have an open file
> descriptor or a mapping.
>
> A neat trick for temporary files that you want to make sure get cleaned up is
> to open() and unlink() immediately afterward.
>
> The file data will be automatically deleted when your process exits.
>
> Marcel
>
>
> _______________________________________________
>
> /
Would the file itself be accessible by another process before your process
exits?
_______________________________________________
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]