tags:

views:

612

answers:

6

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?

+8  A: 

It stands for permanent generation:

The permanent generation is special because it holds meta-data describing user classes (classes that are not part of the Java language). Examples of such meta-data are objects describing classes and methods and they are stored in the Permanent Generation. Applications with large code-base can quickly fill up this segment of the heap which will cause java.lang.OutOfMemoryError: PermGen no matter how high your -Xmx and how much memory you have on the machine.

Andrew Hare
A: 

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.

Jesse
A: 

It holds stuff like class definitions, string pool, etc. I guess you could call it meta-data.

Nick
+1  A: 

Simple (and oversimplified) answer: it's where the jvm stores its own bookkeeping data, as opposed to your data.

Matt
A: 

"Applications with large code-base can quickly fill up this segment of the heap which will cause java.lang.OutOfMemoryError: PermGen no matter how high your -Xmx and how much memory you have on the machine."

And no way to configure/set it higher ?

use -XX:MaxPermSize=128m (and change 128m to whatever you wish to give it)
tucuxi
A: 

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.

DKSRathore