Java – Setting permsize, xmx and xms values in java

javajvm

I have some questions about setting permsize, xmx and xms values in java. These are:

  1. Default size of permgen size is 64 MB. Not sure how much default is defined for heapsize?

  2. How much maxpermgen and xmx values are permitted for a given RAM (2gb/4gb)?

  3. Should I keep xmx and xms parameter equal or not? What is the benefit of keeping them diferent?

  4. Should I keep XX:permgensize and XX:maxpermgensizeparameter equal or not?

Best Answer

.1. The default maximum heap in Java 6 is 64 for the client JVM and 1/4 of the memory or 1 GB for the server JVM.

http://download.oracle.com/javase/6/docs/technotes/guides/vm/gc-ergonomics.html

.2. The maximum sizes for the 64-bit JVM is limited by the available memory.

.3. Using a lower minimum means it can use less memory if it doesn't need it. If you know exactly how much memory you want the heap to use, you can set both to the same.

.4. Again, if you know exactly how much you want it to use, make them the same. If you would like it to use less if its not needed, just set the maximum.

Unless you know you need to set these parameters, I wouldn't. I would let the JVM workout what a good value is.