Fw: [ODE] Problem in dReal *L = (dReal*) ALLOCA (740216);

Jon Watte hplus-ode at mindcontrol.org
Mon Jul 26 13:56:16 MST 2004


> > be dReal *L = new dReal[ n*nskip*sizeof(dReal) ];

> > delete[ ]L;

> I'm not sure that variable-sized array declarations
> are standard C(++) though.  (But then again, neither
> is alloca!)

new[variable] is perfectly valid C++ on any platform.

The problem with this suggestion is that it involves 
global operator new, which is akin to malloc, and will 
grab locks on most modern implementations -- i e, it's 
SLOW. Which was the whole reason alloca() was used in 
the first place.

The quick solution for Liu is to instruct the Windows 
linker to set aside 4 MB of stack space or more.

The better solution for ODE in the long run is to change 
to a linear-allocator-based ALLOCA replacement, as we've 
discussed on this list before.

Cheers,

		/ h+




More information about the ODE mailing list