I'm working on a Windows XP Pro machine with VisualC++ 6.0. The program I'm working with is a large GUI program written in C++ and using the QT framework. Most of this program was not written by me. The point of the program is to automatically take a large number of pictures (around 2000). This process takes about 5 hours.
In one function of the program, a system() call is used to run a standalone executable. At about hour 1.5, this system call suddenly stops working and returns a value of -1073741502. This line of code has, at this point, already been called 500-600 times, without any problems - then for no apparent reason it fails and never works again until I reboot the program.
I have three questions:
1. How can I figure out what the return value of the system call means?
2. Does anyone have an idea of what could be causing it or how to fix it?
3. Is there a way in Visual C++ 6 to trace an error backwards? That is to say, if I hit an error in debug mode, is there a way for me to trace backwards to see which functions I am in?
1. How can I figure out what the return value of the system call means?
Google...It is usually best to google the code in hex: 0xc0000142.
So it looks like the application failed to initalize properly (the one called via system?).
2. Does anyone have an idea of what could be causing it or how to fix it?
Memory leak?
3. Is there a way in Visual C++ 6 to trace an error backwards? That is to say, if I hit an error in debug mode, is there a way for me to trace backwards to see which functions I am in?
Look at the call stack.
I don't think we really have enough information to answer with any certainty. If the error is occurring within the standalone executable, then you won't be able to get any answers from visual studio.
Did this just start happening? Was it working fine before?
If it were me, I would try to run the app with fewer iterations(try taking 500 pictures). If it runs fine like that, then I would immediately start thinking about a possible memory issue. Maybe this standalone exe isn't releasing memory correctly, and every one of these pics is stored on the heap...suddenly you get to a certain point and then it crashes. Just a guess.
I think the root cause of this error has always been there, but the program hasn't been asked to take this many pictures before now. It seems to run fine with fewer pictures.
Also, if I shut down and restart the program, it works fine for another 500 pictures - would that indicate that it's the main program that's causing the problem, or could it still be the standalone exe?
The return value from the failed system call is STATUS_DLL_INIT_FAILED.
A google search of your error brings up tons of references to heap exhaustion(some sort of memory leak), which fits your symptoms. If you aren't the developer of the app or exe, it's a tough thing to track down.
The blog references a tool called dheapmon, that will at least let you know if this is what is causing your problems.