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

Close MemorySegments passed to upcalls after the upcall is done

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: repo-panama
    • Fix Version/s: None
    • Component/s: tools
    • Labels:

      Description

      Currently, we don't close MemorySegments that we pass to upcalls. This makes it easier to leak a MemorySegment from an upcall, but it also incurs an additional copy on Windows and Aarch64, and forces users to close these segments manually instead.

      We can instead registers these segments with a NativeScope that is closed after the upcall completes, to make sure these segments do not leak inadvertently, and we don't need the additional copy on some platforms.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jvernee Jorn Vernee
                Reporter:
                jvernee Jorn Vernee
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: