5

I am using java "1.6.0_24" OpenJDK. Sometimes when I run my program, all that I get is a message

Could not create the Java virtual machine.".

Some other times, the program runs perfectly fine.

Is there some set of options that I can add to get more verbose output as to the exact error (maybe even something similar to a core dump?).

This is probably not related to the heap size since in that case, it does give a definite and clear error message like :-

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

This I could fix with setting -Xms and -Xmx appropriately. However, the JVM quitting without printing anything else at all is very unhelpful.

Just to clarify, my question is about coaxing more verbose error messages or some sort of status files / core dumps which I can then use for debugging.

owagh
  • 3,428
  • 2
  • 31
  • 53
  • Well I have a machine with 64 GB RAM and I set -Xms to 100M. While this machine is part of a cluster, the free memory is usually about 16GB (which I verified by running top on a seperate terminal). Same problems with that too... (I have other machines with much less RAM in the cluster which is why I set -Xms to 100M to solve _that_ problem) – owagh May 28 '13 at 19:25
  • I'm not sure what could be more verbose than that. Memory allocation is one of the very first things JVM initialises. Obviously, your problem came from -Xmx not -Xms parameters. JVM allocate the heap to the maximum size at the initialization. Your maximum limit is too high. On 32bit JVM, you can only use no more than 1.5GB – gigadot Aug 07 '13 at 00:12

2 Answers2

1

Start with a small heap. Set -Xms far lower than -Xmx. Increase the maximum heap size, -Xmx to some 1024(or 2048 depending on your application). Set -Xms to some 512 (I'd say half of Xmx)

avijendr
  • 3,958
  • 2
  • 31
  • 46
  • I've already tried that. That does resolve some issues but not all. If you read second half of the question, it does say that I have already used -Xms and -Xmx to resolve some issues related to lack of memory. Thanks though! – owagh May 30 '13 at 14:08
  • @owagh What OS do you use? I guess it's Unix/Linux if so what flavour? – avijendr Jun 05 '13 at 23:01
0

Not sure about OpenJDK but have you tried http://www.oracle.com/technetwork/java/javase/crashes-137240.html#gbyyz ?

Henry
  • 9
  • 1