10.15.2011

As you may already know, the
initial version ofJava 7 has been
releasedfrom Oracle last
July 28 which includes many changes and improvements.

One of the important changes is
the beginning of removal of the PermGen (Permanent Generation) space.

* UPDATE: PermGen space is official removed in Java 8 and replaced by Metaspace.

PermGen removal?

That is correct.

I’m sure you faced in the past
at least one occurrence ofOutOfMemoryErrordue to the PermGen space
depletion of your HotSpot VM. This problem is quite common and often due to
dynamic re-deployments of your application e.g. load and unload of your Java EE
application from your application server is often triggering Class metadata
leak; ultimately leading to the full depletion of your fixed PermGen space.

However, Oracle JRockit and IBM
JRE were not designed with a PermGen space at the first place. They use the
C-Heap (native memory) instead to store the Class metadata.

Current Oracle JVM strategy is
to merge both HotSpot and JRockit product lines to a single JVM project that
will include the best features of each VM.

What no PermGen means for you in the future?

No PermGen space means no more
configuration and tuning of this memory space via –XX:PermSize &
-XX:MaxPermSize since Class metadata will be moved to the native memory (C-Heap) & OldGen space and no longer configurable.

However, my recommendation to
you is to increase your level of alertness and monitoring on your native memory
space e.g C-Heap. Like the Java Heap, you could still be facing capacity or
leak problems of your native memory space so please ensure to include this
analysis in your JVM capacity planning exercise.

Is PermGen space removed yet?

Not completely yet. As
mentionedfrom the
Oracle Blog, the PermGen removal will take some time so don’t expect a
complete removal until a few more releases of Java 7.

To conclude, I ran a simple
test using a sample Java 7 program with verbose:gc turned on and as you can see
the PermGen memory space is still present in this HotSpot release(build 21.0-b17).

Please feel free to provide your comments and share your thoughts on the imminent removal of the PermGen space.

Thanks Javin for sharing your article as well. Yes PermGen will not longer exist. But it won't eliminate class loader related memory leaks. This just means that these leaks will now eating up at the Native Heap directly.