RFR: 8286637: (fc) Memory mapped regions bigger than 2GB do not work correctly on Windows
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Thu May 12 20:58:52 UTC 2022
On Thu, 12 May 2022 19:15:23 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> Cast the last parameter `dwNumberOfBytesToMap` of `MapViewOfFile()` to a `SIZE_T`, not a `DWORD`, to avoid truncation.
test/jdk/java/nio/channels/FileChannel/LargeMapTest.java line 64:
> 62: MemorySegment mappedMemorySegment = MemorySegment.mapFile(p, 0,
> 63: p.toFile().length(), FileChannel.MapMode.READ_WRITE,
> 64: ResourceScope.newSharedScope());
Note that I've integrated JEP 424. As a result, you will need to update this test in the following ways:
* replace `jdk.incubator.foreign` with `java.lang.foreign`
* add @enablePreview to the test
* replace `ResourceScope` with `MemorySession`
* the `map` method for segments has moved into `FileChannel`, for constistency
In addition, I think it would be better to use `MemorySession.openImplicit()` as session/scope parameter, since we don't want to call close explicitly.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8686
More information about the nio-dev
mailing list