Personally, I don't consider PermGen a special part of the heap.
I would rather think of the heap as a memory area for storing instances of an object, and PermGen as a region for storing class definitions. As a result, the heap life cycle is tied to the application, and the PermGen life cycle is tied to the JVM.
One of the best examples of why an application and its JVM can have a different life cycle in a Java EE container. On the application server, applications can be deployed and deployed without restarting the server. During undeployment (or redistribution) it is easy to free all instances of the object, i.e. empty space, but it’s rather difficult to remove all classes loaded by this application from PermGen, because some of the classes can still reference the JVM.
One such case is a driver leak . When the application is deployed, the JDBC driver is downloaded and registered using the DriverManager. When this application is not deployed, DriverManager lives and contains a link to the driver, its original class loader and all the loaders of this class. The result is a memory leak in PermGen, but this is not an application memory management error.
True, the JVM, like JRocket, does not have PermGen at all, everything is stored on the heap. Only in this context can you call PermGen the “special part” of the heap. Even then, we should still consider PermGen and the bunch differently, as they have a completely different purpose, and they have very different types of memory leaks.
Update . In Oracle, JDK 8 PermGen is replaced by and is now officially part of the heap. We no longer need to configure PermGen.
Christopher Yang Jun 03 '13 at 3:13 2013-06-03 03:13
source share