Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8286637

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 17, 18, 19
    • Fix Version/s: 19
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b23

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: