[ODE] stack requirements
David McClurg
dmcclurg at pandemicstudios.com.au
Thu Jul 18 22:49:01 2002
In my simulation I enter dInternalStepIsland_x2() with nb=25 and this routine is taking a ton of stack space to where i get a stack overflow. I didn't think 25 bodies was too bad. Anyone have ideas for me? I'm running on an embedded system and I can't just keep increasing memory requirements.
here are the alloca calls for step.cpp
$ grep -ni alloca step.cpp
39:#define ALLOCA dALLOCA16
290: dxJoint **joint = (dxJoint**) ALLOCA (nj * sizeof(dxJoint*));
297: dReal *I = (dReal*) ALLOCA (3*nb*4 * sizeof(dReal));
298: dReal *invI = (dReal*) ALLOCA (3*nb*4 * sizeof(dReal));
332: dxJoint::Info1 *info = (dxJoint::Info1*) ALLOCA (nj*sizeof(dxJoint::Info1)
);
333: int *ofs = (int*) ALLOCA (nj*sizeof(int));
368: dReal *invM = (dReal*) ALLOCA (n6*nskip*sizeof(dReal));
382: dReal *fe = (dReal*) ALLOCA (n6 * sizeof(dReal));
383: dReal *v = (dReal*) ALLOCA (n6 * sizeof(dReal));
394: dReal *vnew = (dReal*) ALLOCA (n6 * sizeof(dReal));
402: dReal *c = (dReal*) ALLOCA (m*sizeof(dReal));
403: dReal *cfm = (dReal*) ALLOCA (m*sizeof(dReal));
404: dReal *lo = (dReal*) ALLOCA (m*sizeof(dReal));
405: dReal *hi = (dReal*) ALLOCA (m*sizeof(dReal));
406: int *findex = (int*) alloca (m*sizeof(int));
418: dReal *J = (dReal*) ALLOCA (m*nskip*sizeof(dReal));
451: dReal *JinvM = (dReal*) ALLOCA (m*nskip*sizeof(dReal));
455: dReal *A = (dReal*) ALLOCA (m*mskip*sizeof(dReal));
470: dReal *tmp1 = (dReal*) ALLOCA (n6 * sizeof(dReal));
474: dReal *rhs = (dReal*) ALLOCA (m * sizeof(dReal));
489: dReal *lambda = (dReal*) ALLOCA (m * sizeof(dReal));
490: dReal *residual = (dReal*) ALLOCA (m * sizeof(dReal));
499:// dReal *L = (dReal*) ALLOCA (m*mskip*sizeof(dReal));
507:// dReal *lambda = (dReal*) ALLOCA (m * sizeof(dReal));
601: dxJoint **joint = (dxJoint**) ALLOCA (nj * sizeof(dxJoint*));
608: dReal *I = (dReal*) ALLOCA (3*nb*4 * sizeof(dReal));
609: dReal *invI = (dReal*) ALLOCA (3*nb*4 * sizeof(dReal));
647: dxJoint::Info1 *info = (dxJoint::Info1*) ALLOCA (nj*sizeof(dxJoint::Info1)
);
648: int *ofs = (int*) ALLOCA (nj*sizeof(int));
682: dReal *cforce = (dReal*) ALLOCA (nb*8 * sizeof(dReal));
690: dReal *c = (dReal*) ALLOCA (m*sizeof(dReal));
691: dReal *cfm = (dReal*) ALLOCA (m*sizeof(dReal));
692: dReal *lo = (dReal*) ALLOCA (m*sizeof(dReal));
693: dReal *hi = (dReal*) ALLOCA (m*sizeof(dReal));
694: int *findex = (int*) alloca (m*sizeof(int));
721: dReal *J = (dReal*) ALLOCA (2*m*8*sizeof(dReal));
750: dReal *JinvM = (dReal*) ALLOCA (2*m*8*sizeof(dReal));
796: dReal *A = (dReal*) ALLOCA (m*mskip*sizeof(dReal));
854: dReal *tmp1 = (dReal*) ALLOCA (nb*8 * sizeof(dReal));
866: dReal *rhs = (dReal*) ALLOCA (m * sizeof(dReal));
890: dReal *lambda = (dReal*) ALLOCA (m * sizeof(dReal));
891: dReal *residual = (dReal*) ALLOCA (m * sizeof(dReal));
900:// dReal *L = (dReal*) ALLOCA (m*mskip*sizeof(dReal));
912:// dReal *lambda = (dReal*) ALLOCA (m * sizeof(dReal));
964: dReal *tmp_vnew = (dReal*) ALLOCA (nb*6*sizeof(dReal));
1007: dxBody *state = (dxBody*) ALLOCA (nb*sizeof(dxBody));