[ODE] Stack overflow

Nate W coding at natew.com
Fri Jan 31 10:10:02 2003


On Fri, 31 Jan 2003, Shaul Kedem wrote:

>  In C and C++ overflowing the stack means memory
> overwrite, This is one of the non-managed run times
> problems, and managed code is a solution for this (and
> the memory leaks thing...) problem.

Actually, the OS catches the attempted overwrite before it happens, and
control returns to the catch(...) block before any damage is done.  

>  In short, I can't see a way in which such a "try"
> will do anything else but exit gracefully.

When this happens in Juice, the simulation ends and application switches
back to editing mode.  That's not an option for games, of course. :-)

>  The question I ask myself (and you guys) : does
> anybody knows how to define an implicit memory
> de-allocation when a function ends ( because if such a
> thing isn't found we might be looking at some major
> re-write of the function using alloca) ?

I have a hunch that we could do the 'stack unwind' with a single call at
the end of dWorldStep.  This might take more RAM than unwinding in each
function, but I'm not sure how much more.  For PCs it may be a viable way
to do things; for game consoles or other constrained systems perhaps not.

-- 

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