+1  A: 

Do the errors occur still occur if you attach the debugger after starting the application?

rpetrich
The reason this matters is that processes started by the debugger use a special "debug heap". See http://blogs.msdn.com/larryosterman/archive/2008/09/03/anatomy-of-a-heisenbug.aspx or http://msdn.microsoft.com/en-us/library/974tc9t1.aspx .
crosstalk
Thanks to both of you, I'll check tomorrow. It is indeed a heisenbug, and a random one at that, as I can get a few debug cycles under way before it exhibits itself again.
Lasse V. Karlsen
only if I start through the debugger, and only the .NET debugger.
Lasse V. Karlsen
+1  A: 

a debug version of a linked dll could be compiled with signaling nan support, see http://blogs.msdn.com/oldnewthing/archive/2008/07/02/8679191.aspx for an example of this problem.

that heisenbug was caused by uninitialized variables, here there could be a linked dll enabling the snan feature of the cpu and forgetting to disable it upon returning

Lorenzo Boccaccia