Does Java impose some form of array length limitations that doesn't involve INT_MAX or memory size of allocation?
I have a perplexing error surrounding VM memory limits. Machine is 64 bit x86 with 64GB of RAM. I have increased heap space to 64GB and application only reaches ~15GB, but can increase to 20-30GB without any problems.
Specifically, the error is of type:
java.lang.OutOfMemoryError: Requested array size exceeds VM limit
But I have plenty of heap space. To prove this, I wrote the following code (and the error shows the appropriate line is triggering the error)
int[] x = null;
x = new int[600000000]; // triggers error
int[] x = null;
int[] a = null;
int[] b = null;
int[] c = null;
a = new int[500000000];
b = new int[500000000];
c = new int[500000000];
x = new int[600000000]; // triggers error
So the 3 arrays a,b,c take up much more memory than x. However, x triggers the error in both circumstances.
Thanks for any insight you have into the problem!
Aaron
Edited by: aaron101net on May 6, 2009 8:23 PM