tags:

views:

594

answers:

2

I'm wondering how you would go about designing a good permgen space string in Java. Based on my research and understanding I've come up with the following:

example: JAVA_OPTS='-Xmx512m -XX:MaxPermSize=256m -server - Djava.awt.headless=true'

sorry the example didn't paste when I first posted the question......

A: 

Daniel, could you explain what you mean by permgen-space string, possibly by posting your example?

Urs Reupke
+3  A: 

I am also a bit unclear on the question, but if you mean what is a good number to use for max permgen size, it will depend on your app and the number of classes/methods loaded. To help deterine them, you could run your application with its typical and most intense use cases and use JConsole and see what your app actually ends up using.

JConsole can display all of your heaps and your permanent generation space, so you can determine what number is required for MaxPermSize that way. Since it's class + method data, it will be a function of how many classes your application loads, not how many instances. Note that it is also separate from heap size (and in fact, JConsole categorizes the the memory use as non-heap-memory use), At the JConsole page I linked, see Figure 5. It is the right-most non-heap and can be clicked.

In Java 6, apps will allow connections from JConsole with no additional configuration. In Java 5, you may need to set some flags. It is included with the JDK.

For reference, for an application that has ~10,000 classes loaded our MaxPermSize is 96m

Joshua McKinnon
Yes thanks! This is exactly the sort of information I am looking for....
DanielHonig