title: Java crashing before filling up heap space
body: <p>I have this java simulator that will need to handle a huge amount of data. It works fine, but one I get up to an array of <code>int[100000][100][2]</code> along with other big arrays. the program says that its out of memory. (<code>Java.lang.outOfMemoryError</code>)</p>
  
  <p>All fine and good, I just give it more memory, but It seems to always run out around ~300M even though I allow it 2GB. This is all from watching Task manager. </p>
  
  <p>Is there something wrong with my system, or is this just a java thing that I need to deal with?</p>
  
  <p>@DanielPryden</p>
  
  <p>OS: Win 7 32Bit 4GB of ram on board</p>
  
  <p>JVM Command: java -Xmx2048M -Xms2048M Simulator</p>
  
  <p>Error Data: Had to get from an IDE (using IntelliJ). I dont know how to do it from cmd. I assume this is what you are looking for.</p>
  
  <pre><code>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)
  </code></pre>