Eclipse + GWT -> Out of memory in development mode

旧城冷巷雨未停 提交于 2019-12-01 17:52:56

问题


If I run my GWT application in eclipse in development mode and click around in the browser for some time, I always get an "out of memory" error in eclipse. My computer has 16 GB Ram, and there is never used more than 8GB.

I tried several config parameters. The VM-arguments in my Run configuration contain these parameters: "-Xms8192m -Xmx8192m"

Even in the eclipse.ini I tested several config parameters and now it looks like this:

--launcher.XXMaxPermSize
8192M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
8192m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms8192m
-Xmx8192m

But I still get the error. Is there any way to prevent this?


回答1:


If the browser application is throwing the OutOfMemoryError, then you don't need to change the Eclipse settings (eclipse.ini), that's only for Eclipse itself (more memory, usually faster workbench).

To increase an app's memory (any Java app launched from Eclipse), go to the Run/Debug configurations... in the Run menu and set the VM arguments on the Arguments tab of the app's run config:

-Xms128M -Xmx1024M -XX:MaxPermSize=256M



回答2:


put this in vm arguments in your run configurations: -Xmx2048M -XX:MaxPermSize=512m




回答3:


If I run my GWT application in eclipse in development mode and click around in the browser for some time, I always get an "out of memory" error in eclipse.

Not exactly sure what the problem is but I do see some issues with your current arguments.

  1. You have 2 launcher args that are the same. You don't need the 2nd entry of:

    --launcher.XXMaxPermSize
    8192M
    
  2. I really doubt that you want 8g of PermSize. Something like 512m is probably much better. You can use jconsole to see how much memory is in the perm space bucket. In the below image taken from jconsole's memory tab, the bar highlighted at the bottom right shows the "Perm Gen" space. Right now it is using 26,906kb (or around 27mb). That's where code goes and it often has to be increased if you have many JSP pages which get compiled as well.

    If you run your application with the following params you should be able to connect with jconsole to see how it's doing:

    -Dcom.sun.management.jmxremote
    -Dcom.sun.management.jmxremote.authenticate=false
    

    I suspect that you are going to see that you are using far, far less in the "Perm Gen" space. The -Xmx8192m (or -Xmx8g) is all you need typically. It will give 8gb of memory to the heap in general which is typically short lived objects. It also scales the various different memory partitions accordingly.

For more information about various heap spaces see the Java hotspot documentation.



来源:https://stackoverflow.com/questions/18430607/eclipse-gwt-out-of-memory-in-development-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!