what to do with tomcat PermGen space

前端 未结 7 1736
盖世英雄少女心
盖世英雄少女心 2020-12-07 19:22

BACKGROUND: I have a web Project which uses JSP. The IDE is Eclipse. The configuration of tomcat is: Automatically publish when resources change and publish

相关标签:
7条回答
  • 2020-12-07 19:35

    setting like this:

    -Xms128m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=256m
    

    enter image description here

    0 讨论(0)
  • 2020-12-07 19:36

    Tomcat server runs different JAVA and the eclipse runs in different JAVA.

    So adding -XX:MaxPermSize=512m to eclipse.ini will help resolving this issue. Follow the below steps to add this to tomcat server:

    • Double click server in eclipse

    • open launch configuration

    • add "-XX:MaxPermSize=512m" to VM arguments in the Arguments tab.

    0 讨论(0)
  • 2020-12-07 19:41

    You may set environment variable named : "JAVA_OPTS" and set value of it as follows -Xms256m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m

    0 讨论(0)
  • 2020-12-07 19:47

    Tomcat does need a lot of permgen. 512m is not an unreasonable max. However it only delays the hot-deploy leak. Permgen will grow ~25mb per hotdeploy, which, in Eclipse, might be every time you save a Java file. 512m disappears fast if you have a Ctrl+S twitch like me.

    The solution: allow Java to kick class definitions out of memory, i.e., garbage collect byte code. Add these along with your boosted permgen size:

    -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC
    
    0 讨论(0)
  • 2020-12-07 19:50

    FOR ECLIPSE

    1. Go to server properties
    2. Go to platform
    3. Now in VM argument write this -Xms256m -Xmx256m -XX:PermSize=256m -XX:MaxPermSize=512m

    FOR NETBEANS

    1. Go to Netbeans folder/etc/
    2. open netbeans.config in any editor
    3. edit this line as

    netbeans_default_options="-J-client -J-Xss256m -J-Xms256m -J-XX:PermSize=256m -XX:MaxPermSize=512m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true"

    Thats all

    0 讨论(0)
  • 2020-12-07 19:51

    Just to add for Windows, if someone is still stuck:--

    1. Open catalina.bat file (located at Apache tomcat installation folder/bin)
    2. Set JAVA_OPTS as follows in the very start(before actually its first use anywhere in the file):--

      set JAVA_OPTS=-Dfile.encoding=UTF-8 -Xms128m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=256m

    3. Restart Tomcat and its done.

    You can find nice explanation here

    0 讨论(0)
提交回复
热议问题