views:

327

answers:

2

In the Sun JVM, classes that are loaded by the class loader are put in permgen space and never gc'd. (Unless the class loader goes out of scope) It's my understanding that JRockit puts that same data on the heap instead. Is that data then subject to garbage collection?

Thanks.

+2  A: 

The problem has nothing to do with where the classes get allocated. The problem is that classloaders always keep references to their classes, which means that classes cannot be garbage collected unless and until their classloader gets garbage collected.

This problem is just more obvious on HotSpot, because PermGen memory is scarce and expensive.

Jörg W Mittag
A: 

Another salient point though is that PermGen is often exhausted in Sun's whereby other JVMs may allocate in another not-so-limited space.

Xepoch
Yeah, I like the way JRockit handles it a lot better than Sun.
Striker
Some argue that IBM does too. The flip side to this is that sometimes you can add a lot into class text and can be not the easiest to detect leaks or held text. Sun allows you to at least report a little easier on the data held therein and preemptively tune.
Xepoch