Method to unmap MappedByteBuffer
Alan Bateman
Alan.Bateman at oracle.com
Mon Jan 14 08:03:44 UTC 2019
On 13/01/2019 17:02, Luke Hutchison wrote:
> :
>
> I asked about this on StackOverflow, and one of the responses
> indicated that POSIX file deletion semantics have been added to recent
> builds of Windows 10, via FILE_DISPOSITION_POSIX_SEMANTICS :
>
> https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntddk/ns-ntddk-_file_disposition_information_ex
>
> This allows the file to be "deleted" while open by causing it to be
> hidden in the directory until it is closed (also allowing another file
> of the same name to be created in its place -- so the file is
> presumably also renamed).
>
> It looks like this is a solution to the file deletion part of this
> long-time problem, for new Windows builds at least. Can this be added
> to NIO for mmap'd files, if the Windows version supports it? (Actually
> it would be great to make POSIX semantics the default for all file
> operations in Java on Windows, but mmap is the most problematic case
> right now.)
>
Thanks for this, it's something to check out. That said, removing a
file that is memory mapped has consequences if the file is removed or
truncated (SIGBUS on Unix systems). That would need to be investigated
to see what the impact would be. Also requiring DELETE_ON_CLOSE might be
an issue too. FileChannel supports this option but it's usually for
niche cases where you are using temporary files.
-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190114/85020953/attachment.html>
More information about the nio-dev
mailing list