title: Big array C++ , vector no memory
body: <p>I need huge array in C to store some data. The thing that i am working on is related to DNA sequencing. I am using Visual Studio 2013.</p>
  
  <p>Firstly, I've tried with a global static variable like</p>
  
  <pre><code>static oligo SPECTRUM[C1][C2]
  </code></pre>
  
  <p>Where oligo structure contains eight integers, and C1 is 100000 and C2 500.</p>
  
  <p>But visual said that the array is to large. Then I asked Google, and he said that's good idea to use vectors. So i switched to these by replacing code above with a code below</p>
  
  <pre><code>static std::vector&lt;std::vector&lt;oligo&gt;&gt; SPECTRUM;
  </code></pre>
  
  <p>It was said that is a nice thing to resize vector before using, so i did:</p>
  
  <pre><code>SPECTRUM.resize(C1);
  for (int i = 0; i &lt; C1; i++)
  {
      SPECTRUM[i].resize(C2);
  }
  </code></pre>
  
  <p>but now I am having runtime exception throwed during execution of above code (resizing)</p>
  
  <pre><code>An unhandled exception of type 'System.Runtime.InteropServices.SEHException' occurred in ConsoleApplication1.exe
  </code></pre>
  
  <p>in file xmemory0. Visual shows the exception is throwed here</p>
  
  <pre><code>else if (((size_t)(-1) / sizeof (_Ty) &lt; _Count)
      || (_Ptr = ::operator new(_Count * sizeof (_Ty))) == 0)
      _Xbad_alloc();  // report no memory
  </code></pre>
  
  <p>I want you to know also, that I have 4 GB RAM avaiable on my computer, and I estimate that my program shouldn't use more then 1 GB RAM.</p>