I am getting PermGen space error on Sun JVM (1.6.0_21-b06) (Ok, it’s Oracle :)). Increasing of option -XX:MaxPermGen value does not help. I know that PermGen is a space intended for permanent objects like class metadata. Count of classes in project is not so big ~ 10 000. Before crash jvisualvm shows 57MB as Used PermGen.
I guess that some algorithm occupies all accessible memory. Does someone know examples of algorithms that lead to PermGen overflow ?
UPD. I ask such abstract question, because in the moment I can not use any profiler – code crashes so hard that jvisualvm and eclipse stop to respond. I need than kill java processes from terminal with kill -KILL {process_numer}. I work with bad organized (but commercial) code that has many threads and JMS messaging. Debugging is a mess – I need some idea first where to look.
Yes but what is the point of this? if you want to fix this install a memory profiler tool like jprobe or lambda probe and check where the memory leak is happening, and fix that.
Now for the example: There are thousands of ways to exceed perm gen space. I had noticed on a project when we inherited an application where they were using JMS. The jms connections were left open, the application crashed within a few minutes after it got a lot of requests with a similar error like you are getting. Point to note: when we moved to weblogic from jboss (moved to beajrockit) amazingly it fixed itself or atleast took the blow of technical debt. My advice would be irrespective of this, bad code with memory leaks should be fixed first, then tinker with app servers and heap space allocation paramters.
Here is a useful link with some information on the exception you are getting.
http://www.jroller.com/agileanswers/entry/preventing_java_s_java_lang
EDIT
This link may be helpfull
http://www.precisejava.com/javaperf/j2ee/JMS.htm