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

Marlin: replace terminally deprecated sun.misc.Unsafe memory access methods

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3
    • jfx24
    • jfx23
    • javafx
    • None

    Description

      The Marlin rasterizer uses sun.misc.Unsafe to allocate off-heap memory. All of the memory-access methods in sun.misc.Unsafe have been deprecated for removal by JEP 471 [1] as of JDK 23.

      Starting in JDK 24 or 25, using any of these methods will produce a warning. Some time after JDK 25 they will stop working altogether. We need a replacement. There are three options:

      1. Use Java arrays, meaning the memory would now be on the heap
      2. Use direct NIO buffers for off-heap memory, ByteBuffer.allocateDirect
      3. Use FFM as defined in JEP 454 [2]

      Option 1 will likely be the least-performant option, and is at least as much work as option 2, so is likely not the best choice.

      Option 2 should be pretty straight-forward to implement, at least for the memory allocation and access methods, and should be evaluated for performance.

      Option 3 is the best long-term replacement, but will require adopting JDK 22 as the minimum version of JDK for JavaFX. This is something we could consider in the JavaFX 24 or 25 time frame, so this option should also be evaluated.

      [1] https://openjdk.org/jeps/471
      [2] https://openjdk.org/jeps/454

      Attachments

        Issue Links

          Activity

            People

              lbourges Laurent Bourgès
              kcr Kevin Rushforth
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: