Eclipse + GWT -> Out of memory in development mode

筅森魡賤 提交于 2019-12-01 18:03:13

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

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

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.

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