title: Heap Error in C++
body: <p>I'm a beginner programmer in C++.
  Recently, I'm working on image processing thing using C++.</p>
  
  <p>but I have some problem that I want to ask. Suppose I have some code as follow:</p>
  
  <pre><code>for (int i=0;i&lt;100000;i++)
  {
    int * a = new int[10000];
    //do something
    delete [] a;
  }
  </code></pre>
  
  <p>When I executed that code, I receive runtime error, Heap Error...</p>
  
  <p>Is there anything wrong with that code, I mean, can I allocate memory and release it in the same loop?</p>
  
  <p>Thanks in advance...</p>