[ODE] SIGSEGV in dSolveLCP() at ode/src/lcp.cpp:1137

Adam D. Moss adam at gimp.org
Thu Feb 12 12:40:00 MST 2004


DjArcas wrote:
> My personal thoughts (coming from a console coder) is 'don't allocate memory
> except at startup!'
> 
> If ODE needs 80 megs, fine, but it should allocate it's maximum amount of
> memory at init, then simply use that pool. Unless there's some foible in ODE
> that means it's better to work this way?

alloca() is a great way to get a variable amount of temporary
memory from the stack VERY quickly (probably always faster
even than any hand-rolled LIFO arena-allocator).

 > Allocating memory has also always
> been something I've labelled under 'slow', too...

Absolutely true, and getting it from the heap is just silly
if it's just for temporary use -- IF there are no other
options.  If your app's stack usage is so large that it
overflows the stack and you can't tune that away, or
your system doesn't support alloca(), then you'd need
something like the proposed change.

Macro-izing the use of ALLOCA() would make it trivial
to implement your LIFO in a pre-sized pre-allocated arena if
that's your preference.

--Adam
-- 
Adam D. Moss   . ,,^^   adam at gimp.org   http://www.foxbox.org/   co:3
"At this point the rocket becomes engorged with astronauts."


More information about the ODE mailing list