What happens if String Pool runs out of memory?

What happens if there are many string literals in the String Pool, and it runs out of memory. Does it increase its size, if so, how? If not, what happens if I try to create more string literals?

+4
source share
1 answer

First item first - STRING POOL Does not have string literals

String Pool is a set of links pointing to String objects.

When you write String = "hello", it creates a "hello" object on the heap and places a link to this object in the string string pool (assuming the object is no longer on the heap named "Hello")

"" ​​ . , , . , , GC

?

, string canonicalisation. HashMap. HashMap , . .ie , JVM.

?

NO STRING POOL DOESNOT GROW IN SIZE -

?

-XX: StringTableSize = N , N -

:

, String Pool ?

: java.lang.OutOfMemoryError:java.lang.OutOfMemoryError: Java heap space java 7 . java.lang.OutOfMemoryError: PermGen space java 6

+12

All Articles