I have a Java application that’s very String-heavy – it takes a feed of huge numbers of big, different String objects.
Do I need to worry about the String Constant Pool for memory and performance?
Is there any way to see how big the pool is at any point?
As Mario said, the constant pool is only relevant to intern()ed Strings, and to Strings that are constants in java code (these are implicitly interned).
But there is one more caveat that might apply to your case: The
substring()method will share the underlyingchar[]with the original String. So the patternmight cause unexpected memory usage.