Java 17 bug (?) on Windows with MemorySegment.asSlice and offset =

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu May 12 11:24:01 UTC 2022


On 12/05/2022 12:19, Maurizio Cimadamore wrote:
> One thing I noticed is that using file sizes that are a power of two 
> will get rid of errors. 

The reason this works, I think, is that, in those cases the truncated 
value is exactly zero,

 From the specifciation of MapViewOfFile:

https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-mapviewoffile

```
If this parameter is 0 (zero), the mapping extends from the specified 
offset to the end of the file mapping.
```

So, I think that can be used as a valid workaround, at least in case you 
want to create a memory region that has the full size of the memory mapping.

Maurizio






More information about the panama-dev mailing list