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?
Not exactly sure what the problem is but I do see some issues with your current arguments.
You have 2 launcher args that are the same. You don't need the 2nd entry of:
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:
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.
put this in vm arguments in your run configurations: -Xmx2048M -XX:MaxPermSize=512m
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 theVM arguments
on theArguments
tab of the app's run config: