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

Ensure MemorySegment is initialized before touching NativeMemorySegmentImpl

XMLWordPrintable

      We have a circular dependency between the intialization of MemorySegment and NativeMemorySegmentImpl.

      MS has a NULL field, whose initializer directly calls one of the NMSI constructors. NMSI depends on the initialization of MS because it is a super type.

      If user code tries to initialize both classes at the same time, then deadlock can occur.

      We can avoid this issue by ensuring MS is initialized before trying to use NMSI directly in our implementation. The following API points might touch NMSI directly without going through MS first:

      - FileChannel
      - Linker
      - ArenaImpl
      - SymbolLookup

            jvernee Jorn Vernee
            jvernee Jorn Vernee
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: