Duplicate Strings Content dashlet

To open the Duplicate Strings Content dashlet, click Show Strings in the Overview tab, or use the context-menu of a memory snapshot. It shows the post-processing result of the string duplicate analysis. The corresponding information is only available if you enable string value capturing while you create the snapshot. The table shows all strings that are included at least twice in the snapshot.

Duplicate Strings Content dashlet
Duplicate Strings Content dashlet

The individual columns show the following information:

  • String value: String value of the corresponding string Instances. For an expanded string, shows the individual string instances that allow further analysis drilldown. The Follow References Dashlet drilldown is available for the first-level string value records, showing where corresponding string duplicates are referenced.
  • Count: Number of string duplicates.
  • String length: String length in characters.
  • Sum GC Size: Sum of the Garbage Collection Size of the corresponding string duplicates.
  • Saving Potential: Amount of bytes that you can save potentially, if all duplicates are eliminated.

Eliminate string duplicates

If strings are not massively duplicated you should not have to remove duplicates. If a snapshot contains many strings and the Garbage Collection Size of these strings is quite high, however, check string duplicates. To investigate where the string duplicates are referenced, use the Follow References Dashlet drilldown on the string record.

To prevent duplicates, internalize strings or create a string cache. Strings are stored in the Perm Gen, which may fill up. You can build a custom string cache to long-term reference only a single string Instance. Usually, you have to look up a string.