Repeated calls to executable via system command freezes randomly (Windows 7 Pro)

  • Thread starter Thread starter k7miller
  • Start date Start date
K

k7miller

Guest
Hi,


I have the following problem that I hope you can help me with. I am developing a windows application in C++ (Visual Studio 2015) that contains a loop similar to the following


for (int i = 0; i < N; ++i) {

system("exec1.exe & exec2.exe");

}


That is, I am using the command processor to call executable 1 followed by executable 2, repeatedly. The number of loop iterations may be anywhere from 10 to 10,000 or higher. The issue I am having occurs when the number of loop iterations is large, say 1,000 or higher. I find that my application will be running smoothly and then randomly the call to executable 2 from within the loop will freeze and I will have to kill my application (note that executable 1 always completes successfully). When this happens, the executable 2 process can be seen in the task manager, but appears idle. The loop index at which this issue occurs appears to be random, and in some rare cases, the loop will finish without any issues. As far as I can tell this is an issue with the Windows operating system as I have been able to reproduce it with other pieces of code. Any information you can provide to solve this problem would be greatly appreciated.


Thanks,

Killian

Continue reading...
 
Back
Top