(fc) Memory mapped regions bigger than 2GB do not work correctly on Windows

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 19
    • Affects Version/s: 17, 18, 19
    • Component/s: core-libs
    • None
    • b23

      The Windows implementation of FileChannel::map seems incorrect, as it converts a jlong byte size into a DWORD, thus dropping 32 bits on the floor:

      ```
      mapAddress = MapViewOfFile(
              mapping, /* Handle of file mapping object */
              mapAccess, /* Read and write access */
              highOffset, /* High word of offset */
              lowOffset, /* Low word of offset */
              (DWORD)len); /* Number of bytes to map */ <------
      ```

      This issue was discovered and reported in the panama-dev mailing list:

      https://mail.openjdk.java.net/pipermail/panama-dev/2022-May/016977.html

      Of course this was never an issue with MappedByteBuffer, whose size can never exceed 2^32.

            Assignee:
            Brian Burkhalter
            Reporter:
            Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: