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

ResourceScope handles should keep parent scope reachable

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: repo-panama
    • Fix Version/s: None
    • Component/s: tools

      Description

      When working with "untrusted" segments, the user might want to do this:

      ```
      try (var handle = segment.scope().acquire()) {
         // operate on segment safely
      } // ok now segment can be closed
      ```
      While this works to protect against deterministic deallocation, it fails to protect against implicit deallocation. So, if the segment becomes unreachable inside the TWR, its scope could still be closed (which might cause issue if e.g. the user has taken a long address out of the segment and operating on it).

      For these reasons, it would be preferrable if a scope handle would also help in keeping the scope reachable.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mcimadamore Maurizio Cimadamore
              Reporter:
              mcimadamore Maurizio Cimadamore
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: