0

I have tried al the solutions lije Setting ANT VARIABLE. SEtting XMX & XMS variable from netbeans. Still I am getting same error. I tried by setting the values of xmx & xms to 3000m also still i am getting same error.

My main memory is of 8GB.

The system is out of resources. Consult the following stack trace for details.

java.lang.OutOfMemoryError: Java heap space

    at sun.misc.Resource.getBytes(Resource.java:93)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:256)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:881)
    at com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:866)
    at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:639)
    at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:665)
    at com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2198)
    at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:617)
    at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1289)
    at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1259)
    at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:765)
    at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:730)
    at com.sun.tools.javac.main.Main.compile(Main.java:353)
    at com.sun.tools.javac.main.Main.compile(Main.java:279)
    at com.sun.tools.javac.main.Main.compile(Main.java:270)
    at com.sun.tools.javac.Main.compile(Main.java:69)
    at com.sun.tools.javac.Main.main(Main.java:54)
E:\TYPRo\nbproject\build-impl.xml:952: The following error occurred while executing this line:
E:\TYPRo\nbproject\build-impl.xml:287: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 7 seconds)
Aify
  • 3,543
  • 3
  • 24
  • 43
  • 1
    What command line parameters are you using? – Saket Apr 13 '15 at 09:29
  • Notice he seems to be trying to compile his code with javac when he gets this error, not running it. A bit more context would indeed be necessary like how you are running javac and what are you trying to build? – Didier L Apr 13 '15 at 09:57
  • Just a simple remark: you are using the 64bit compiler, right? – Christian Apr 13 '15 at 10:05

1 Answers1

0

Sometimes, increasing the max heap will not solve your problem. See if outOfMemory is due to memory usage or memory leak. Try to get the heap dump and analyse it with some tools like eclipse MAT. That will give you a picture on which objects eats much of your memory. I believe netbeans has it's own profiler to check the heap dumps.

Command to create heap dump:

jmap -dump:live,format=b,file=heap.bin

Rajesh
  • 382
  • 3
  • 14
  • That would indeed be generic advice that usually applies, but notice how in this case it is actually the java compiler that is running out of memory. You can't profile something which you can't even get to build properly. – Gimby Apr 13 '15 at 12:43