What is java.lang.OutOfMemoryError: PermGen space?
Ans:
The java.lang.OutOfMemoryError: PermGen space indicates that the region of constant generations in memory has been exhausted.
Any Java application may use a limited amount of memory. The exact amount of memory that your particular application can use is indicated at application startup time.
Java memory is divided into different areas, which can be seen in the following image: 
What will be the solution to this error in the PermGen space?
Ans:
For a heap,
export JVM_ARGS="-Xms1024m -Xmx1024m"
For Permgen,
JVM_ARGS="-XX:PermSize=512M -XX:MaxPermSize=512m"
You can also specify an additional section
-XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC XX:+CMSClassUnloadingEnabled
You can also provide an additional section :)
-XX:PermSize=512m -XX:MaxPermSize=512m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -XX:SurvivorRatio=2 -XX:MaxTenuringThreshold=128 -XX:TargetSurvivorRatio=90 -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing -XX:CMSIncrementalDutyCycleMin=0 -XX:CMSIncrementalDutyCycle=10 -XX:+UseTLAB -XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled
Metaspace: a new memory space has appeared
Now the JDK 8 HotSpot JVM uses internal memory to represent class metadata and is called Metaspace ; similar to Oracle JRockit and IBM JVM's .
The good news is that this means more java.lang.OutOfMemoryError: PermGen space problems, and you no longer need to configure and control this memory space.
Related link:
Java 8 Links
source share