PermGen space Java
PermGen stands for Permanent Generation. It is a special type of heap space. It is separate from the main memory (heap). JVM uses PermGen to keep track of loaded class metadata. All the static content is stored by the JVM to this memory section. Static content can be a static method, references to the static object and primitive variables. PermGen also contains information about bytecode, names, and JIT. Before releasing Java 7, String Pool is also available in this space and separate from it after releasing Java 7.
The JVM memory is divided into two parts, which are as follows:
The PermGen space contains the internal representation of the Java classes that JVM holds. The Permanent Generation is the garbage data that is collected in the same way as heap's other parts collected. It is a special area of memory that contains meta-data of the program's classes and the program's objects. It also contains the class-loaders that are manually destroyed at the end of the use. Here, the Garbage Collector is not that efficient and due to which it causes the Out of Memory: PermGen space error quite a few times.
The main disadvantage of the PermGen space is that it's maximum size is fixed. The 64 MB and the 82 MB are the maximum memory size for 32-bit and 64-bit version of JVM, respectively. We can modify its default size with the help of the following options:
Let's take an example to generate the PermGen space error and analyze it.
Now, run the above code as a configuration. We will add the following command to the argument:
The argument value will redirect verbose garbage collection output to a file gc.log.
After clicking on the Run, we get the following output.
Next TopicUnsigned Right Shift Operator in Java