[ODE] Stack overflow

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


On Fri, 31 Jan 2003, Marco Grubert wrote:

> > 1) double your physical memory
> > 2) a couple orders of magnitude bigger than you expect to need
> 
> (1) does not work because you do not know how much memory your users have,
> unless you supply them with a utility like editbin to alter the EXEs memory
> layout..

Maybe I should be more clear.  

The point is to choose a stack size so ridiculously large that if the
memory demands ever actually get that big, there won't be anything to be
done about it anyhow.  

I had been under the impression until now that the problem was that ODE
uses stack allocation for large data structures.  In light of recent
events, I now believe that this is actually *not* a problem.

The /STACK linker option basically tells Windows that it should puke when
the application tries to use more than N bytes of stack.  This problem is
easily solved: use a spectacularly large value for the /STACK linker
option.  If 800MB doesn't sound like enough, use 800GB.  They'll behave
the same way at run-time, at least until machines with more than 800MB
become common.

> I am experimenting with some Win32 commands to hopefully create
> somewhat more reliable stack handling- I will get back to the list on
> that on Monday. Also, going through a number of articles it seems that
> with WinXP you can finally adjust stack space on-the-fly, but of
> course making your app or ODE WinXP specific is not a good idea yet.

I haven't looked at XP details, but I have a hunch that this on-the-fly
stack adjustment is subject to a ceiling set by the /STACK linker option.  
That is how Win2k works.  Setting that ceiling to HUGE_VAL seems to me
like a perfectly acceptable solution.

-- 

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