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

Use private static final char[0] for empty Strings

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P5
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: core-libs
    • Subcomponent:
    • Resolved In Build:
      b47
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        In an average heap dump, 292 kB is wasted from empty Strings having their own char[] of length 0. Instead, the String class should declare a zero-length char[] and use that for empty Strings. The constructor should detect that an empty String is being created and use the common char[].

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                lpriima Lev Priima
                Reporter:
                nreynold Nathan Reynolds
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: