jan
jan

Reputation: 4103

Eclipse + GWT -> Out of memory in development mode

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?

Upvotes: 5

Views: 9332

Answers (3)

Gray
Gray

Reputation: 116878

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.

    enter image description here

    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.

Upvotes: 0

Sebastian
Sebastian

Reputation: 55

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

Upvotes: 1

TWiStErRob
TWiStErRob

Reputation: 46480

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

Upvotes: 8

Related Questions