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

MemorySegment::reinterpret cleanup action is not called for all overloads

XMLWordPrintable

      There is an obvious bug in the for AbstractMemorySegment::reinterpret(long, Arena, Consumer):

      @Override
      @CallerSensitive
      public final MemorySegment reinterpret(long newSize, Arena arena, Consumer<MemorySegment> cleanup) {
          Objects.requireNonNull(arena);
          return reinterpretInternal(Reflection.getCallerClass(), newSize,
                  MemorySessionImpl.toMemorySession(arena), null); // <------------ note the null here
      }

      The cleanup is not passed to the "internal" function. As a result, no cleanup function will be called when the segment is closed.

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

              Created:
              Updated:
              Resolved: