I have this java simulator that will need to process a huge amount of data. It works fine, but I go up to the array int[100000][100][2]along with other large arrays. the program says its lack of memory. ( Java.lang.outOfMemoryError)
int[100000][100][2]
Java.lang.outOfMemoryError
Everything is fine and good, I just give it more memory, but it seems that it always ends at about 300 M, although I assume it is 2 GB. This is all from viewing the task manager.
Is there something wrong with my system, or is it just a Java thing that I need to deal with?
@DanielPryden
OS: Win 7 32Bit 4 GB of RAM on board
JVM Team: java -Xmx2048M -Xms2048M Simulator
Error data: I had to get from the IDE (using IntelliJ). I do not know how to do this from cmd. I guess this is what you are looking for.
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Simulator.main(Simulator.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
32- Windows, 2 . Windows, , - , 3 , ( JVM Java). , JVM Sun/Oracle, 1,5 , JNI , DLL , .
, 64- , . -, , , . LinkedList , . ; , , , 64 .
LinkedList
, , , Java, . , 32- Windows , , 4 , .
. -Xmx2GB, . , , -Xms2GB. , , , 2 , - , ..
, , . - .
:
, . -XX: MinHeapFreeRatio = -XX: MaxHeapFreeRatio =, -Xms -Xmx.
jvm (1.6.26) 30/70, ( -Xmx1G) 700 .
jvm-. , -Xmx1G -XX: NewRatio = 10, .
, Java (, ). - , OutOfMemoryError , .
( ) :
5.0 Java [tm]
EDIT : I can't play it on my inbox (Mac OS X, 8Gb RAM). Given that a single array occupies approximately 200 MB + in memory, I agree with brettw that it does not have a contiguous block of memory of this size causing this problem (not the generation size). As for the fix, use the collection along with regular arrays or buy more memory (recommended :-))