Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7903896

JMH: Trim down String literals in generated code

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • None
    • None
    • tools
    • None
    • jmh

      It is apparent in the heap dump I got when investigating JDK-8345302 that javac compilation of JDK benchmarks corpus takes significant memory holding String literals referenced in JMH generated code. About 0.6% of them are these top three:

      $ java -jar jol-cli-latest.jar heapdump-strings make/java_pid72581.hprof

      Heap dump contains 24.074.729 objects, 1.044.366.688 bytes in total.

      === Duplicate Strings
        DUPS: Number of duplicated String instances
        SIZE (V): Savings due to String.value dedup (automatic by GC)
        SIZE (S+V): Savings due to entire String dedup (manual)

      Table is sorted by "DUPS".
      Printing first 30 lines. Use -DprintFirst=# to override.
                
                  DUPS SIZE (V) SIZE (S+V) VALUE
      ------------------------------------------------------------------------------------------------
                17.511 1.540.968 1.961.232 Yes, I am Stephen Hawking, and k... (69 chars)
                17.499 1.399.920 1.819.896 Harness failed to distribute thr... (58 chars)
                17.499 1.959.888 2.379.864 Today's password is swordfish. I... (91 chars)
      ...
      ------------------------------------------------------------------------------------------------

            shade Aleksey Shipilev
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: