[ODE] works on linux crashes on msvc

Nate W coding at natew.com
Fri May 2 22:20:02 2003


On Fri, 2 May 2003, Benny Kramek wrote:

> I am using the linker that is in MSVC 6.0 I tried setting the "stack
> reserve" size to many different values(8, 80, 800, 8000, 80000,
> 800000, 8000000, 80000000, lots more). The same thing always happens.
> I also tried compiling in release mode instead of debug mode and the
> same thing always happens.

Far as I can tell, the stack won't get bigger than about 8MB no matter how
many zeroes you have in that linker setting. :-/

Do you know how many joints are in the simulation when it crashes?  Even
with an 8MB stack I can blow the stack with a system that I think contains
about 30 hinges and 30 contact joints.

Also, try wrapping dWorldStep in a try/catch block, e.g.

	try
	{
		dWorldStep (m_WorldID, rElapsedTime);
	}
	catch (...)
	{
		OutputDebugString ("Simulation failure.\n");
	}

This will handle a Win32 stack overflow somewhat gracefully.  You should
(I think) be able to put a breakpoint in the catch block and then examine
the state of the system.  That might give you some clues.  Maybe increment
a counter each time you create a contact joint (and zero it before each
step), so you can see how many contacts there are when the simulation
crashes.  I'm guessing you'll find a lot of them, making for a big matrix
and a big stack allocation.  

Also, if you can get your hands on VC7, that debugger gives you the option
of breaking immediately on all sorts of exceptions, including stack
overflows.  


Nate Waddoups
Redmond WA USA
http://www.natew.com