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

MemorySegment::allocateNative should be tolerant of zero-sized allocation requests

XMLWordPrintable

      MemorySegment::allocateNative throws IllegalArgumentException if its size parameter is <= 0. This seems to be inconsistent with the fact that Unsafe::allocate/freeMemory seems to be tolerant of that, and that you can still create zero-sized segments from e.g. direct buffers (or Java arrays).

      This is discussed in more details here:
      https://mail.openjdk.java.net/pipermail/panama-dev/2022-January/016071.html

            mcimadamore Maurizio Cimadamore
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: