[ODE] stack requirements
David McClurg
dmcclurg at pandemicstudios.com.au
Thu Jul 25 20:52:01 2002
i just changed dStack to use "new char[max_size]" and it works great for me. If you can pre-allocate a 1/2 meg or so for ODE then your "real" stack requirements are small.
You can also create a dStrackFrame object to do the popFrame() call automatically for you when you leave the current scope block. Just declare a dStackFrame at the top of each block that uses dStack::alloc()
// used to auto push/popFrame
class dStackFrame
{
dStack& stack;
char* newframe;
public:
dStackFrame(dStack& stack_) : stack(stack_)
{
newframe = stack.pushFrame();
}
~dStackFrame()
{
if (stack.popFrame() != newframe)
{
dError(0, "stack frame");
}
}
};
-----Original Message-----
From: Russ Smith [mailto:russ@q12.org]
Sent: Tuesday, 23 July 2002 8:59 AM
To: ode@q12.org
Subject: Re: [ODE] stack requirements
> ode/src/stack.cpp/h seems to be a *unused* replacement for alloca. is
> this something that never got finished or didn't work out? Here's the
> interface...
this was used at one point for the joint groups. the implementation uses
mmap() (or the windows equivalent) to allocate non-physical memory
space, then allocates memory in as needed. this is conceptually nice but
not totally portable to all *nixes (at least not without a pile of
work), which is why it was abandoned.