Unnecessary allocation in AliasFileParser

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 9
    • Affects Version/s: 7u45, 8
    • Component/s: 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.

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

                Created:
                Updated:
                Resolved: