Created
February 26, 2017 20:25
-
-
Save adgon92/e75e775a6cb43430c53933199c427a13 to your computer and use it in GitHub Desktop.
Java tips
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. String Deduplication of G1 Garbage collector to Save Memory from Duplicate String in Java 8 | |
String deduplication is not enabled by default in Java 8 JVM. You can enable String deduplication feature | |
by using -XX:+UseStringDeduplication option. Unfortunately, String deduplication is only available for the | |
G1 garbage collector, so if you are not using G1 GC then you cannot use the String deduplication feature. | |
It means just providing -XX:+UseStringDeduplication will not work, you also need to turn on G1 garbage collector | |
using -XX:+UseG1GC option. String deduplication also doesn't consider relatively young String for processing. | |
The minimal age of processed String is controlled by -XX:StringDeduplicationAgeThreshold=3 option. | |
The default value of this parameter is 3. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment