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

Unnecessary allocation in AliasFileParser

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 7u45, 8
    • Fix Version/s: 9
    • Component/s: core-svc
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b45

      Backports

        Description

        sun.jvmstat.perfdata.monitor.AliasFileParser calls an internal debug logging method that always discards the input string since logging is disabled. Unfortunately the input strings are still constructed which causes a lot of allocation due to string concatenation.

        The logging method is:
            private void logln(String s) {
                if (DEBUG) {
                    System.err.println(s);
                }
            }

        It is permantently disabled since:
            private static final boolean DEBUG = false;

        An example of a call to the logging method:
                    logln("matched type: " + ttype + ", token = " + currentToken.sval);

        This could quite easily be fixed by either removing the logging completely or by guarding the logln calls in "if (DEBUG)" blocks.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  redestad Claes Redestad
                  Reporter:
                  owestin Ola Westin
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: