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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 19
    • 17, 18, 19
    • 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.

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

              Created:
              Updated:
              Resolved: