9

ext-Myself and two co-workers have been working on a GWT project and coding in eclipse. The project is growing and we are bringing on several new developers to help out. I have been tasked with setting up their workstations before they start work. Our current systems all worked out of the box following the basic GWT set up guide (http://code.google.com/webtoolkit/usingeclipse.html)

On my working system I have not changed any of the defaults that eclipse has set for memory size.

The new system will run the simple starter projects, so I know that I have GWT set up. When I import our current code base I can run the site locally without issue. When I try and run the ant script that we have to build our project and push it out to our dev server the new system complains:

Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded

On the new system I have modified the eclipse.ini file to and set -Xmx1024M and I have added -Xmx1024M under Window>Preferences>Java>Installed JREs neither of which have solved the problem. (shown here: http://dinu.blog.com/2010/06/02/out-of-memory/)

I have tried 32 and 64 bit versions of eclipse, and I have even tried just copying my known working eclipse folder onto the new system without any luck. Does anyone have any ideas?

trincot
  • 317,000
  • 35
  • 244
  • 286
Jodosh
  • 143
  • 2
  • 8
  • Why you have to use an Ant script to build the project? Eclipse already compiles Java classes for you. You just have to take the directory where Eclipse generates the compiled classes and Jar it. – m0skit0 Feb 16 '12 at 16:04
  • we are using the ant script to build a war that is then deployed to a server running tomcat. We also have the project auto build nightly using the ant script and a build server. – Jodosh Feb 16 '12 at 16:09
  • Just for building the WAR you get out of memory? That's weird... Isn't your Ant script trying to compile the classes (again)? – m0skit0 Feb 16 '12 at 16:14
  • it does compile the java source into bytecode, and then it compiles the bytecode into JavaScript (what GWT calls "Production Mode") and then from production mode into a war. This issue is very weird. the project as it stands right now should not be memory intensive AT ALL. – Jodosh Feb 16 '12 at 16:19
  • As I said, your Ant script does not have to compile the Java classes, which is what I think consumes all memory (idk know why, but same happens on the project I'm working for, looks like an Eclipse problem...), because Eclipse **already** compiles the classes if you have the "Build automatically" option set. You just have to take the *.class*'es already generated and skip this step. – m0skit0 Feb 16 '12 at 16:23
  • Thank you for your help, this does in fact work, but it would require me to maintain 2 build scripts (the build server does not have eclipse to auto build for me. I will just have the devs run ant from the cmd prompt. Your option might end up being the solution in the long run if using the cmd prompt is too burdensome. and I will modify the ant script to do and "eclipse build" or a "build server build". – Jodosh Feb 16 '12 at 17:34
  • Yes, that's best option. – m0skit0 Feb 16 '12 at 19:02

3 Answers3

2

Likely you need to increase the memory for the JVM running ant (via eclipse's external tools preferences) as described here: http://soenkerohde.com/2008/06/change-eclipse-ant-settings-when-you-run-out-of-memory/

nirmal
  • 1,842
  • 18
  • 11
  • that link is almost identical to the the link I included in my original question. the MaxPermSize is the only difference, and in my case it did not help. – Jodosh Feb 16 '12 at 17:26
1

We have similar issues when running certain Ant scripts. You can set VM arguments for the Ant Build in the Run->External Tools->External Tools Configurations dialog. Click the JRE tab and set the usual -Xmx and -Xms params as needed.

Tony
  • 1,401
  • 9
  • 11
0

I have the same problem. I "solved" or better avoid it by building with ant from the command line in a terminal window.

Here someone proposed adding a fork=yes attribute to the build.xml file, and reading this.

knb
  • 9,138
  • 4
  • 58
  • 85
  • This does work for me, and it is a good work around for now. It is another way to do what m0skit0 was suggesting. not ideal but this way I don't have to maintain two build scripts (one for dev boxes and one for the build server.) – Jodosh Feb 16 '12 at 17:30
  • bad link what is here or this is no longer – hram908 Jan 25 '21 at 17:15