2010-04-30

-XX:MaxPermSize 到底要加在哪?

最近用WTP去跑Tomcat,一直出現 java.lang.OutOfMemoryError: PermGen space。

2010/4/30 上午 07:00:41 org.apache.catalina.core.ApplicationDispatcher invoke
嚴重的: Servlet.service() for servlet jsp threw exception
java.lang.OutOfMemoryError: PermGen space
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9228)
    at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9208)
    at org.eclipse.jdt.internal.compiler.parser.Parser.dietParse(Parser.java:7864)
    at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:587)
    at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:357)
    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:371)
    at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:413)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:317)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)

Google的結果是說要加 -XX:MaxPermSize,但是要加在哪呢?

第一、加在eclipse.ini裡,沒用!

第二、eclipse.exe -vmargs -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m,一樣沒用!

最後,加在 Installed JREs > Default VM Arguments > -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m,終於有用了!

沒有留言:

張貼留言