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

(bf) Migrate DirectByteBuffer to use java.lang.ref.Cleaner

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • 25
    • 17, 21, 24
    • core-libs

      DirectByteBuffers are still using old jdk.internal.ref.Cleaner implementation. That implementation carries a doubly-linked list, and so makes DBB suffer from the same issue fixed for generic java.lang.ref.Cleaner users with JDK-8343704. I think we can migrate DBBs to use java.lang.ref.Cleaner.

      With the attached reproducer, we have the similar improvements on DBB churn tests:

      % build/macosx-aarch64-server-release/images/jdk/bin/java -Xmx2g -Xlog:gc DBBGC.java

      # Before
      [16.575s][info][gc] GC(100) Pause Young (Normal) (G1 Evacuation Pause) 1230M->14M(2048M) 48.596ms
      [16.756s][info][gc] GC(101) Pause Young (Normal) (G1 Evacuation Pause) 1231M->14M(2048M) 49.211ms
      [16.932s][info][gc] GC(102) Pause Young (Normal) (G1 Evacuation Pause) 1231M->14M(2048M) 47.930ms
      [17.108s][info][gc] GC(103) Pause Young (Normal) (G1 Evacuation Pause) 1231M->14M(2048M) 47.753ms
      [17.292s][info][gc] GC(104) Pause Young (Normal) (G1 Evacuation Pause) 1231M->14M(2048M) 49.631ms
      [17.467s][info][gc] GC(105) Pause Young (Normal) (G1 Evacuation Pause) 1231M->14M(2048M) 46.266ms

      # After
      [6.793s][info][gc] GC(100) Pause Young (Normal) (G1 Evacuation Pause) 595M->9M(989M) 3.811ms
      [6.862s][info][gc] GC(101) Pause Young (Normal) (G1 Evacuation Pause) 595M->9M(989M) 3.982ms
      [6.930s][info][gc] GC(102) Pause Young (Normal) (G1 Evacuation Pause) 596M->9M(989M) 3.889ms
      [6.995s][info][gc] GC(103) Pause Young (Normal) (G1 Evacuation Pause) 596M->9M(989M) 3.810ms
      [7.062s][info][gc] GC(104) Pause Young (Normal) (G1 Evacuation Pause) 596M->9M(989M) 3.613ms
      [7.126s][info][gc] GC(105) Pause Young (Normal) (G1 Evacuation Pause) 596M->9M(989M) 3.770ms
      [7.192s][info][gc] GC(106) Pause Young (Normal) (G1 Evacuation Pause) 596M->9M(989M) 4.012ms

      The test is both faster, and takes less GC time.

            shade Aleksey Shipilev
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: