Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7903327

Refactor class 'GCProfiler.VMSupport'

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • None
    • None
    • tools
    • None
    • jmh

      Currently, in class `GCProfiler.VMSupport`, the method `newListener` initializes the field `churn` which seems not sensible when considering its name `newListener`.

      And the methods `startChurnProfile` and `finishChurnProfile use the field `listener` to mark whether the profiler has started. It will create a new `Listener` each time the profiler starts and will set it to `null` when finished. Actually it is not necessary to do such instantiation because the listener don't need to be changed. And if such instantiation happens frequently, the GC may suffer from it. I know if the profiler runs only one time, the current code can reduce the space of the listener. It is a balance between time and space here, and I think it is better to save the time (instantiation time and GC time).

            gli Guoxiong Li
            gli Guoxiong Li
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: