title: Debugging memory corruption
body: <p>Earlier I encountered a problem with dynamic memory in C (visual studio) .
  I had a more or less working program that threw a run-time error when freeing one of the buffers. It was a clear memory corruption, the program wrote over the end of the buffer.</p>
  
  <p>My problem is, that it was very time consuming to track down. The error was thrown way down after the corruption, and i had to manually debug the entire run to find when is the buffer end overwritten.</p>
  
  <p>Is there any tool\ way to assist in tracking down this issue? if the program would have crashed immediately i would have found the problem a lot faster...</p>
  
  <p>an example of the issue:</p>
  
  <pre><code>int *pNum = malloc(10 * sizeof(int));
  
  //                 ||
  //                 \/    
  for(int i = 0; i &lt; 13; i++)
  {
  pNum[i] = 3;
  }
  
  // error....
  free(pNum);
  </code></pre>