[ODE] Stack overflow

Nate W coding at natew.com
Thu Jan 30 21:25:02 2003


On Thu, 30 Jan 2003, Marco Grubert wrote:

> a) use Win32 exception handling (__try/__except) to catch the stack overflow

This works, but then the question is how to proceed with the next
dWorldStep.  I have no good ideas about that.

> b) set linker to reserve large amount of memory (max. 1GB I believe) and
> hope that we don't go beyond this amount (apparently stack is allocated as
> needed so the value can be large)

If the stack exceeds physical RAM that's gonna be a problem no matter what
OS you're running.  Virtual memory would probably take over, so you'd just
slow down, but I bet you'd slow down an awful lot. :-)

> c) replace alloca() calls with mallocs and/or use custom memory handler

I used to think this was the best solution, but if you're right about the
stack being allocated as need up to the option specified during the link,
then there's no reason NOT to set the stack size to HUGE_VAL.  

-- 

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