Profile Image
vishnupriya

What is Optimize String Pool: -XX:+UseStringDeduplication?

What is Optimize String Pool: -XX:+UseStringDeduplication? Have you used this JVM argument before? What are the pros & cons of using this Java argument? Can you share your perspective/experience in using this JVM argument?

  • jvm-argument

  • xx-usestringdeduplication

  • x-usestringdeduplication

  • Optimize String Pool

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:

 

-XX:+UseStringDeduplication

 

Description:

 

Based on JDK development team’s research 25 percent of Java applications memory is filled up with strings.  13.5 percent of those strings are duplicates. This shows one neat ways that we can optimize the application – eliminate duplicate strings from our app. Since Java 8u20 in order to do so we can use UseStringDeduplication JVM argument, which will instruct the JVM to try to get rid of all the duplicate strings and optimize heap memory as part of garbage collection process. It will reduce duplicate String values to a single global char[] array. However, keep in mind that it will only work with G1 GC algorithm, if you are using another GC algorithm it will not work unless you will switch to C1.

 

Default Value:

 

Disabled

 

Errors:

 

None

 

Arguments related:

 

TODO link loggc

 

Related Posts:

NOTE:

 

If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your insights will help the entire 10+ million java developer community to develop one standard source of documentation for all the JVM arguments.

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jvm-argument

  • xx-usestringdeduplication

  • x-usestringdeduplication

  • Optimize String Pool