I m using JAVA 5 (32 bit) for my application running on JBoss. But it working fine only for 32bit. As we deploy it on 64bit java5, it throws an Exception
"java.lang.OutOfMemoryError: PermGen space" exception
Is there any Patch required? Is any code code change required?
Thanks in advance.
I have got the same prolem when I run my web application under tomcat or jetty. Permanent genration memory is used for loading the classes and the idea is that "Classes are loaded once and forever". Since I am using quite a lot of libraries and Spring framework, this memory is filled up very quickly espectially when I redeploy the web application several time with out restarting the servlet container.
I found that increasing the maximum permanent generation is not sufficient. You also need to allow the garbage collection to removed the unused classes at runtime, otherwise it will be filled up and throws PermGen space exception. Here are the JVM options that I added for my servlet containers,
-XX:PermSize=128m -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled
-XX:MaxPermSize
is used to set the maximum value of permanent generation. This should be greater than the default size.
-XX:+CMSClassUnloadingEnabled
this option is used to allows JVM to unload the class at runtime. By default, class unloading is disable. For Java 5, please read this.
-XX:+UseConcMarkSweepGC
, in order for class uploading option to work, this option must also be set (ref)
Also, you should consider upgrading your JVM version. Java 5 is too old.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With