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

Unnecessary allocation in AliasFileParser

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 7u45, 8
    • core-svc
    • b45

        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.

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

                Created:
                Updated:
                Resolved: