[ODE] memory leak?
Nate W
coding at natew.com
Fri Dec 21 22:27:02 2001
The good news is, I got the first dynamics action out of my application
today, courtesy of ODE 0.025. This made me pretty happy.
The bad news is, I discovered a memory leak, and I think I've tracked it
down to dCreatePlane() / dGeomDestroy(). The following program, run under
MSVC7 (the .net beta) will report five pieces of memory still allocated:
#include <ode/ODE.h>
#include <crtdbg.h>
int main(int argc, char* argv[])
{
dSpaceID space = dSpaceCreate ();
dGeomID id = dCreatePlane (space,0,0,1,0);
dGeomDestroy (id);
dSpaceDestroy (space);
_CrtDumpMemoryLeaks ();
return 0;
}
If you comment out the dCreatePlane() / dGeomDestroy() pair, no memory is
leaked.
Looking into dCreatePlane(), it appears that pointers to new memory are
returned from dCreateGeomClass() and dCreateGeom(), but inside
dGeomDestroy(), it appears that only the memory from dCreateGeom is freed.
There's also the possibility that I should use some function besides
dGeomDestroy to free the plane geometry - am I overlooking something?
Thanks.