calloc works when debugging, hangs when running
<p>I have a c++ program which I'm running on a windows 7 64bit machine, using Eclipse as my IDE. I use mingw32 for a compiler.</p>

<p><strong>The problem</strong>: When I debug the program using the gdb debugger it runs just fine and does what it needs to do. But when I run it without debugging, either from the command line or from within eclipse (using the same configuration as with the debug), it crashes. 
I tried running the program from the command line and attaching to the process using the debugger, and what I saw is that it reaches the following line of code:</p>

<pre><code>anc_map[ancestry].hap_array = (char**)calloc(anc_map[ancestry].nr_hap , sizeof(char*));
</code></pre>

<p>and just hangs (cpu is not working, and nothing happens although the program is still running).</p>

<p>The above line is actually called more than once, and the hanging occurs the second time it is called (it works the first time).</p>

<p>Any idea what can be the cause for this behavior?</p>

<p>Thanks,
Itamar.</p>

<p><strong>Edit</strong>:</p>

<ol>
<li>I realize that using <em>calloc</em> is a little old-fashioned, but since this is a legacy code I just need to modify a little, I'm trying to avoid doing major refactoring.</li>
<li>I've tried compiling the code and running on linux, and the problem does not occur there, so it has something to do with my configuration on the windows machine</li>
</ol>
