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

JrtPath::resolve off-by-one pre-sizing cause for memory pressure

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b35

      Description

      jdk.internal.jrtfs.JrtPath does this:

              StringBuilder sb = new StringBuilder(path.length() + o.path.length());
              sb.append(path);
              if (path.charAt(path.length() - 1) != '/')
                  sb.append('/');
              sb.append(o.path);
              return new JrtPath(jrtfs, sb.toString(), true);

      Since path is always normalized to not have a trailing slash, the pre-sizing is insufficient (which means we'll always resize the array on the sb.append(o.path) step) and the if unnecessary.

        Attachments

          Activity

            People

            Assignee:
            redestad Claes Redestad
            Reporter:
            redestad Claes Redestad
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: