Java GC tuning for strings

前端 未结 2 1776
情深已故
情深已故 2021-02-06 06:46

Profiling the application I figured out that there are a lot of strings on heap.

In my situation, strings are created on heap and not interned and they are not literals

2条回答
  •  旧时难觅i
    2021-02-06 07:08

    Related to -XX:+UseCompressedStrings, you should have a look at this question: Support for Compressed Strings being Dropped in HotSpot JVM?

    And, related to -XX+UseStringCache, have a look at : JVM -XX:+StringCache argument?

    Btw. Java 7 comes with nice features that allow tuning of String cache when using the interned Strings. See -XX:+PrintSTringTableStatistics and -XX:StringTableSize=n. This way you can optimize the String cache size.

提交回复
热议问题