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

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

    XMLWordPrintable

Details

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: