2014/06/13

java defaults Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

        at java.util.Arrays.copyOf(Arrays.java:2271)
        at java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:178)
===>>

You can use the following command to find out the defaults on the system where your applications runs.

    java -XX:+PrintFlagsFinal -version

Look for the options MaxHeapSize (for -Xmx) and InitialHeapSize for -Xms.

On a Unix/Linux system, you can do

    java -XX:+PrintFlagsFinal -version | grep HeapSize

==>
Very helpful! FYI: The "-Xmx" option corresponds to "MaxHeapSize" in the output of that command and "-Xms" corresponds to "InitialHeapSize"
=>bit