MT4: Tester hangs on the SECOND test run of EA; some residual memory problem??

 

I have a weird problem...

Testing a EA, runs fine produces a backtest.  But the second time I run a backtest with the EA (or any EA for that matter), MT4 immediately hangs and I have to kill it.  It doesn't matter if I try to run with different parameters, a different EA, or if just hit "Start" again; same result.

I have scanned my code for obvious infinite loops - nothing. I saw in another topic that it might be related to the use of time functions so I removed those - no change.  And it always hangs on the second test run, not on the first. 

My best guess is that something gets "left over" from running the EA test, but I cannot figure out what it might be.  I take care to close all open files (one) and to remove any open and pending orders on deinit.

Any suggestions are welcome!

 
Add print statements entering and exiting each of your functions and track it down.