[ODE] Stack overflow
Shaul Kedem
shaul_kedem at yahoo.com
Fri Jan 31 09:08:02 2003
Hi all,
> Question for the others on the list:
>
> If dWorldStep overflows the stack, is there anything
> that can be done to
> make the next step work with less stack? Like turn
> off half the bodies
> and take a step, then toggle the enable/disable
> states of all bodies and
> take another step? I'm sure that would have some
> glaring side-effects,
> but probably not as glaring as halting the
> simulation until the linker
> gets run again. :-)
>
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.
In short, I can't see a way in which such a "try"
will do anything else but exit gracefully.
About re-writing alloca: the nice thing about stack
growing is that when exiting a function the stack goes
back to wherever it was at in the calling function,
this is done implicitly and is one of the things
contributing to the speed of stack allocation, the
other thing being shorter jumps in memory (than in the
heap case) - so saying this is o(1) with a small C is
pretty theoretical, while in real life it may mean
lots (and lots) of swaps...
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) ?
Hope this helps :-)
Shaul
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com