String pool is created in PermGen area or Object area of Heap

Andy897 picture Andy897 · Jan 23, 2015 · Viewed 10.3k times · Source

HERE, author is saying that

3) String pool is created in PermGen area of Heap, garbage collection can occur in perm space but depends upon JVM to JVM. By the way from JDK 1.7 update, String pool is moved to heap area where objects are created.

Is there any specific reason why is it done ? I am not able to find any online. And what are the implications ?

Answer

Walt picture Walt · Jan 23, 2015

The move to Metaspace was necessary since the PermGen was really hard to tune.

Also, it was difficult to size the PermGen since the size depended on a lot of factors such as the total number of classes, the size of the constant pools, size of methods, etc.

Additionally, each garbage collector in HotSpot needed specialized code for dealing with metadata in the PermGen. Detaching metadata from PermGen not only allows the seamless management of Metaspace, but also allows for improvements such as simplification of full garbage collections and future concurrent de-allocation of class metadata.