title: Not sure why I'm getting a segfault in Java/Android when declaring an array
body: <p>So I've got some code that is crashing in Android, and I have no idea why.      </p>
  
  <pre><code>while(true)
  {
      byte[] colorData = new byte[480*800];
      colorData = null;
      System.out.println("what");
  }
  </code></pre>
  
  <p>It prints out "what" three times, then crashes with "Fatal Signal 11 SIGSEGV" (as seen here: <a href="http://i.imgur.com/FYAsi2C.png" rel="nofollow">http://i.imgur.com/FYAsi2C.png</a>). It is definitely running garbage collection, so the issue doesn't seem to be memory running out, but if I lower the size of the array, it takes longer to crash.</p>
  
  <p>If I remove the colorData lines, then the code works and does not crash. I'm very confused. It could be some of the other code, but I can't understand why adding/removing an array declaration would cause the program to crash/not crash.</p>
  
  <p>Any ideas?</p>
  
  <p>Edit:</p>
  
  <p>So when I force the program to run out of memory by upping my byte array size, I get an out of memory exception. What the hell is causing this segfault?</p>