To my knowledge, it's hung on every X5 Advanced that it's been tested on (about half a dozen, most running 2002, some running 2003), hasn't hung on the one X5 Basic it has been tested on, and hasn't been tested on any X3 devices.
However I have made some progress this evening with the help of egarayblas and denthorq to test on iPAQ 1910.
On the 1910, it was failing to start a new game with an out of bounds exception (0xc0000005). It would replay a recorded game fine.
As with the Axim, I was tracking down the problem by adding more and more logging to a file, having testers run the executable, and checking the log file to see if it narrowed down the problem.
With the 1910 exception, we narrowed the problem down to a small piece of code, and finally adding some logging code that eliminated the problem.
Normally, this indicates two things: that timing affects it, or it is a code generation (typically optimizer) problem. In this case, it was traced to a specific log statement, in a specific location, so it was a code generation problem, not a timing problem.
This is the second major code generation problem I've encountered. I detailed the first here a few months ago:
http://www.pocketmatrix.com/forums/view ... c&start=15
You'll note that the previous one, I reproduced in a minimal sample application. It is indeed a compiler bug, check the code yourself if you doubt this.
So what's happening? The statement after the special logging statement was a call to my repeatKey function. This function only does work during new games, which explains why it doesn't fail during recorded games. Then it uses a series of if-else-if statements to pick a key code (these basically depend on the control orientation). Finally it does some indexing into a container of 256 elements (keys). It only repeats every 4 frames, and the exception occurred on the 4th frame of the game.
Now, the previous compiler bug also happened with if-else-if (and switch) statements. So I thought I had it all figured out. The only intriguing thing is that the log statements in that function didn't fix it, and changing to an if-if statement also didn't fix it (though it did fix the previous compiler bug). Why does the log statement before the function call affect the code generated in that function? I'm not sure why, but I'm pretty sure that's what is happening. I just have to do more testing to isolate the cause and effect, but my 1910 testers are sleeping right now, don't wake them.
Anyways, back to Axim. My 1910 tester, now that he could run the game, had the good fortune to experience a hang while the log file was rolling. Analysis of the log file and the code suggested that it was hung in my custom waitForNextFrame function.
This function has no loops, but does call Sleep. So that's an obvious culprit. If that argument were somehow getting corrupted, my application would sleep for a long time and appear to be hung. Also, one Axim tester actually experienced my application "unhang" itself when left long enough, so this fits the evidence.
I'm still not sure why the argument would be corrupted. It's calculated from QueryPerformanceCounter, but not checked. I'm going to add some checking of the value to try to detect if it is becoming abnormal. I still have to check the code for coding errors, but if I don't find any, I will have to figure out why it would become bad.
I still wonder if QueryPerformanceCounter is affected by the XScale's scaling capabilities. The docs say no but I remain suspicious. I asked this a few weeks ago but never received an answer.
I had my tester capture another hang to compare for reproducibility. Thi s hang's log was different. It was like the Axim log which stopped right in the middle of fprintfing a %d integer. Again I'm not sure why that would be the case, with fflush, but I'll continue to suspect the Sleep argument until I can prove otherwise.
So to sum up, I believe a compiler bug is the cause of the 1910 exception, though I'm unsure of the exact trigger at the moment. And I believe a wild sleep could be the cause of my hang, though again I'm unsure of the mechanism which would cause this (and it's definitely more prevalent on some devices).
I don't suspect memory leaks or memory trampling. I use the STL throughout, both 4.5.3 and the newer 5.0 beta. So I'm not allocating or deallocating my own data structures. The STL containers mostly contain ints by value, not pointers or objects. Only a few of them change size once the application has run (using insert and erase). And most traversals are straightforward begin to end.
It's possible that the STL itself is being corrupted by compiler bugs. I do not trust eVC3 anymore.