Java / Using String
Where String pool is located?
Before Java 7, the JVM placed the Java String Pool in the PermGen space, which has a fixed size it cannot be expanded at runtime and is not eligible for garbage collection.
From Java 7 onwards, the Java String Pool is stored in the heap space, which is garbage collected by the JVM. The advantage of this approach is the reduced risk of OutOfMemory error because unreferenced Strings will be removed from the pool, thereby releasing memory.
More Related questions...