I have an application that stores 3 MB in the String pool, which a considerable amount of memory for this particular application. I want to manage all the String by myself, avoiding them to go to the PermGen. I know that Java 7 puts the interned Strings on the heap, but unfortunately Java 7 isn’t an option right now.
There is a way to disable the JVM String pool on Java 6, or at least a way to make the String literals don’t go to there?
According to jlordo’s link – you cannot disable it. However, if you want to avoid interning, you can load strings from file – this way they will not be interned, unless you explicitly say so.