• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need some clarification for PermGen Space

 
Ninad Kuchekar
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have recently come across this Error: java.lang.OutOfMemoryError: PermGen Space, instead of the traditional Java Heap Space.
I read some articles over the web and it was clear as to what this error is, however, it is not clear why the differentiation.

Also, is there a difference in the way the JVM handles garbage collection for 1.5 and 1.6?

Thanks,
Ninad
 
Frank Pavageau
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Sun JVM has its heap divided in 3 sections:
  • the young generation, where new objects are created
  • the old generation, where objects that survive some minor garbage collections are moved
  • the permanent generation, where classes (the code, not the data) are loaded


  • The exception you're seeing just indicates that the permanent generation has filled up. If you don't have unneeded jars in your classpath (which might get loaded anyway due to scanning, for example), your only option is to increase the size of the permanent generation, using -XX:PermSize=XXXm (for the lower limit, if you want to limit the number of resizing) and -XX:MaxPermSize=YYYm (for the higher limit, which is what constrains you at the moment).

    See http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html for a more detailed explanation of the generations, and http://blogs.sun.com/watt/resource/jvm-options-list.html for a list of JVM options. You can use jstat to see the current sizes and usages of the generations in your JVM.

    And no, there are no fundamental differences in garbage collection between the Sun 5 and 6 JVMs. Still, there's a new type of OOM in 6, when the garbage collection takes a high enough percentage of the time that you can tune with another -XX option.

    Frank
     
    Ninad Kuchekar
    Ranch Hand
    Posts: 64
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks Frank,
    decent links there...
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic