Exception in thread “main” java.lang.OutOfMemoryEr

2019-02-12 08:22发布

I am developing an application with GWT and GAE. When I try to rebuild it or create an artifact I get a lot of errors shown below in the picture.

I searched google and Stack Overflow and I got some answers but not to my particular problem.

From what I understand I get the error because my garbage collector consumes a lot of memory.

enter image description here

here is the main error Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded.

6条回答
Summer. ? 凉城
2楼-- · 2019-02-12 08:24

I had encountered the same problem

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

and when I tried to fix this error it showed the same error. So don't panic and just increase size a little more by setting this option in Run->Run Configurations->Click on arguments->inside VM arguments type

 -Xms1024M -Xmx2048M

Xms- for minimum limit

Xmx- for maximum limit

查看更多
ゆ 、 Hurt°
3楼-- · 2019-02-12 08:25

Adio's answer is correct, except that I needed to change it to 1000Mb when we added the "gwt-mobile" library - 512 Mb was still giving me the "GC overhead limit" error. I think 128Mb is a pretty poor default - that didn't work for us even when we began writing our app.

查看更多
小情绪 Triste *
4楼-- · 2019-02-12 08:30

Changing the config through the project properties in netbeans didn't work.

My solution was to edit the nbproject/gwt.properties with:

# Additional JVM arguments for the GWT compiler
gwt.compiler.jvmargs=-Xmx1024M
查看更多
混吃等死
5楼-- · 2019-02-12 08:43

In NetBeans 8.2 do the following

Right click on Project Name -> Properties -> Google Web Toolkit

Modify JVM Arguments to -Xmx512M

Click Ok

Run again

This work for me on Windows 10, Netbeans 8.2, GWT 2.8.2, JDK 1.8

查看更多
Juvenile、少年°
6楼-- · 2019-02-12 08:47

OK, I fixed the problem. just increase the memory that the virtual machine needs to compile the project. Previously it was 128 and now I change it be 512. as my project grown it needed more memory to compile the classes of the project.Here is how to do that in Injtellj IDEA. right click on the project module -> open module settings -> Modules -> GWT -> compiler maximum heap size (Mb) -> changed to 512.

enter image description here

NOTE: In Ideal Intellij 12+ The project settings is in : File -> Project Structure OR Ctrl+Alrt+Shitf+S

查看更多
叛逆
7楼-- · 2019-02-12 08:48

I tried all the suggestions in a number of posts on the net and none of them worked. After much experimenting, in the end I found that using the G1GC garbage collector on OSX made a big difference for me. If you are using ANT then you must make sure the build file launches the compiler with the G1GC garbage collector

查看更多
登录 后发表回答