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

Adam D. Moss adam at gimp.org
Thu Feb 12 17:51:21 MST 2004


Simon Barratt wrote:
>>Ultimately, yes, a reusable stack on the heap would solve these 
>>problems as well, with less overhead.  But I don't know that anybody's
>>written one yet, and in the meantime, malloc/free is very useful.

[A stack-on-reserved-heap should be near-trivial to implement once
the ALLOCA/FREEA points are in, albeit not *quite* as efficient as
alloca()]

> Another benefit of using a reusable stack on the heap is that you can
> eliminate the dSetZero's by simply wiping whatever you use in your stack
> for that step.. 
> 
> So you'll do all your alloca's into your new stack, use up say 10k of
> space and then the stack system is refreshed by zeroing the whole thing
> and setting the pointer back to the start of the stack.. Voila no more
> stack overflows, redundant dSetZero's and a speedup :)

I can't see that working...  If we were talking about a disposable
grow-only arena then yes (on the post-zeroing point), but this is
a stack.  Also, protection against stack overflows doesn't just
magically happen when using a stack-on-heap; stack overflows
just turn into heap corruption instead. :D  We could just do the same
accounting that would be needed there on a original alloca()
implementation, if need be, once it's wrapped in the macros.

-- 
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