While learning about java memory profiling, I keep seeing the term \"perm space\" in addition to \"heap.\" I know what the heap is - what\'s perm space?
Perm space
is used to keep informations for loaded classes and few other advanced features like String Pool
(for highly optimized string equality testing), which usually get created by String.intern()
methods.
As your application(number of classes) will grow this space shall get filled quickly, since the garbage collection on this Space is not much effective to clean up as required, you quickly get Out of Memory : perm gen space error. After then, no application shall run on that machine effectively even after having a huge empty JVM.
Before starting your application you should java -XX:MaxPermSize
to get rid of this error.
It holds stuff like class definitions, string pool, etc. I guess you could call it meta-data.
The permgen space is the area of heap that holds all the reflective data of the virtual machine itself, such as class and method objects.
Permgen space is always known as method area.When the classloader subsystem will load the the class file(byte code) to the method area(permGen). It contains all the class metadata eg: Fully qualified name of your class, Fully qualified name of the immediate parent class, variable info, constructor info, constant pool infor etc.
Perm Gen stands for permanent generation which holds the meta-data information about the classes.