This discussion is archived
1 Reply Latest reply: Mar 29, 2011 8:42 AM by 849865 RSS

java.lang.OutOfMemoryError with 4 GB memory? -Xmx1024m  really too much?

562466 Newbie
Currently Being Moderated
I called JRockit version JDK_1.6.0_20-R28.1.0-4.0.1 as follows and got an

Exception in thread "Main Thread" java.lang.OutOfMemoryError

Why? I have on a 64bit Win7 system 4 GB physical memory with hardly any running programs:

"C:\Program Files\JRockit\JDK_1.6.0_20-R28.1.0-4.0.1\bin\java" -Xms512m -Xmx1024m -jar testprog.jar -i -a parm1 parm2

When I lower the -Xmx value to e.g.712m it works. The Task Manager shows 1256 "free" and 2435 "available"

As far as I heard JRockit has the advatage to deal much better with heap space than Suns JDK.
So everything should be fine to run the prog.

So why is there a problem?

Peter
  • 1. Re: java.lang.OutOfMemoryError with 4 GB memory? -Xmx1024m  really too much?
    849865 Newbie
    Currently Being Moderated
    Running out of memory doesn't necessarily mean your heap size is the problem. To help track the issue, please paste the stacktrace because it might reveal some clues as to why it ran out of memory. It could be related to your PermGen Space (which I think needs to scale with heap size since it stores information about the objects in your heap), Thread Allocation Size (which I hear fixes allocLargeObjectOrArray errors), or something else. I'm not an expert but I could try to help you experiment with adjustments.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points