Out of memory error in java arrays
<p>I am using the following piece of code  in one of my methods in java:   </p>

<pre><code>int []  byte_song = new int[8414449];
int []  int_song = new int[8414449 - 45];
</code></pre>

<p>If i just write:</p>

<pre><code>int []  byte_song = new int[8414449];
</code></pre>

<p>it does not give me any error. However if i write:</p>

<pre><code>int []  byte_song = new int[8414449];
int []  int_song = new int[8414449 - 45];
</code></pre>

<p>it gives me <code>OutOfMemoryError</code>.</p>

<p>I also tried calling <code>System.gc();</code> before <code>int []int_song = new int[8414449 - 45];</code> still i get the error. Can some body please help me out in this.</p>
