ZGC: Poor interaction between ZGC and JFRs jdk.OldObjectSample implementation

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • 27
    • Affects Version/s: 25
    • Component/s: hotspot
    • gc

      JFR's memory leak profiler (underneath the event jdk.OldObjectSample) samples object allocations and wraps a sample in a weak handle.

      ZGC only does weak reference processing in the old generation. Therefore, all objects that would usually die because we are sampling a lot of stuff that immediately becomes garbage will be artificially kept alive until an old-generation collection.

      This incurs a significant performance hit by causing allocation stalls.

      Attached is a reproducer, along with basic -Xlog:gc* log files, comparing runs when the JDK.OldObjectSample event is enabled vs disabled.

      The easiest way to turn on / off the event (it is turned on by default) is to override event settings on the command line, like so:

      -XX:StartFlightRecording:jdk.OldObjectSample#enabled=false

            Assignee:
            Unassigned
            Reporter:
            Markus Grönlund
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: