简体   繁体   中英

Grails and PermGen issue with g:link and g:render

I've been running grails for sometime without any issues but recently after an upgrade to Grails 1.1.1, I've encountered the dreaded PermGen errors. Prior to the upgrade, no such issue.

The error seems to be happening when the <g:link> and <g:render> tags are used in a GSP although I'm not sure it's indicative that this is the issue but more of the fact that it ran out of space when these tags were being rendered.

Typically, everyone who encounters PermGen errors recommend increasing your java environment options -- but what maybe the source of the issue? Is it a Grails 1.1/hibernate/spring problem?

The error:

2010-04-20 05:37:03,962 INFO  [STDOUT] 05:37:03,961 ERROR [GroovyPagesServlet] Error processing GSP: 
Error executing tag <g:render>: org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: 
Error executing tag <g:link>: java.lang.OutOfMemoryError: PermGen space 
org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: 
Error executing tag <g:render>: 
org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: 
Error executing tag <g:link>: java.lang.OutOfMemoryError: PermGen space

Large PermGen space requirements are a result of the automatic recompile feature that Grails offers in development mode. Having to increase PermGen space is a very, very small price to pay for on-the-fly recompiles. This issue does not arise in Grails production mode. The need for large PermGen is because Java stores class info in a portion of memory referred to as PermGen. This area of memory is completely distinct from heap and other portions of memory. (Increasing heap space does not increase PermGen size). When Grails recompiles a class it results in a new class being added to PermGen (rather than the existing class info being replaced). As you make more changes in devel mode, more and more PermGen memory is consumed.

上面有很好的解释。...尝试增加

export JAVA_OPTS="-Xms256m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=512m" 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM