title: malloc with huge multidimensional arrays, failing for a neuroscience sim
body: <p>I'm setting up a very large array to handle a primitive neuron simulation. New[] craps out when assigning memory (about 8-9 Gig) for the array. I was able to get C-style malloc to reserve the memory, but as soon as I try to assign a value, I get an Access violation reading location 0xffffffffffffffff.</p>
  
  <p>I'm running 64-bit Windows 7, with Visual Studio 2010 Professional. I've tried malloc and new[] with nested loops as well and they crash also. </p>
  
  <p>If this is impossible for malloc to do, what else should I consider? I need something that can access large memory spaces very fast. Thank you for your consideration.</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;time.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;iomanip&gt;
  #include &lt;locale&gt;
  #include &lt;math.h&gt;
  using namespace std;
  
  int nRows;
  int nCols;
  int nDepth;
  int nData;
  
  int main()
  {
          //unsigned long int brainSize=100;
          //nRows = int(pow(brainSize,0.3333333333333333333333333333))+1;
              nRows=80;
          nCols=nRows; 
          nDepth=nRows;
          nData=2000;
  
          double brainData = nRows*nCols*nDepth*nData;
          double brainBits = 4*brainData;
          cout.imbue(std::locale(""));
          cout &lt;&lt; fixed &lt;&lt; "Brain size : " &lt;&lt; nRows*nCols*nDepth &lt;&lt; " neurons \nBrain integers : " &lt;&lt; setprecision(0) &lt;&lt; brainData &lt;&lt; "\nBrain bits: " &lt;&lt; brainBits &lt;&lt; endl;
  
      __int64 ****brain;
      brain =  (__int64 ****)malloc(nRows*nCols*nDepth*nData*sizeof(__int64 ****));
          cout &lt;&lt; "Brain initialized.";
          brain [2][2][2][2]=2; // error is here. 
          cout &lt;&lt; brain[2][2][2][2];
  
  
      int breaker;
      cin &gt;&gt; breaker; //pause
      return 0;
  
  }
  </code></pre>