[ODE] Segfaulting ODE with too many objects -- ALLOC vs MALLOC

Kyle Hubert khubert at gmail.com
Thu Sep 28 12:24:40 MST 2006

On 9/28/06, Jason Perkins <starkos at gmail.com> wrote:
> On 9/28/06, Tanguy Fautre <tanguy.fautre at spaceapplications.com> wrote:
> > Already implemented a long time ago (was already there in 0.5). See
> > dUSE_MALLOC_FOR_ALLOCA compilation flag.
> I've added this flag to `ode/build/config-default.h` as well as to the
> premake build scripts; the next release will include it in the default
> config.h file.
> My system is really just a toy at this point - I'd love to see some
> performance numbers from people doing "real" work with ODE.

Well, dUSE_MALLOC_FOR_ALLOCA only allows lcp.cpp and step.cpp to use
malloc instead of alloc. With all the calls to malloc must come calls
to free, most of the other code just assumes the memory will be freed
when we return from the current function. My particular error wasn't
even in the step.cpp/lcp.cpp code, so this wouldn't solve my error. :)

One more thing, if you look in release 0.7 on line 409 in
ode/src/quickstep.cpp, you'll see an unprotected alloca. In fact, I
count two unprotected allocas in collision_space.cpp and six
unprotected allocas in quickstep.cpp. That's only my quick poking. I
smell a code review.

Does anyone know where the stack.h/stack.cpp code gets used? It seems
like it's a simple heap based stack algortihm. It still explodes when
you run out of space, but it appears to be initialization tunable. It
isn't compiled anymore though, and the code would still have to be
updated with push_frame/pop_frame calls.

Anyways, I'll try out that malloc patch that someone else sent in.

Thanks everyone.


More information about the ODE mailing list