[ODE] memory leak?

Nate W coding at natew.com
Sat Dec 22 14:01:01 2001


On Sat, 22 Dec 2001, Russ Smith wrote:

> > The bad news is, I discovered a memory leak, and I think I've tracked
> > it down to dCreatePlane() / dGeomDestroy().
> 
> okay... the geometry code allocates a small number of blocks on the
> heap that it never frees (used to store object class pointers and
> such). these blocks are allocated once per application, not once per
> object, so there is really no "leak".

May I suggest....

void dCloseODE () 
{
	for (int i = 0; i < classes->size (); i++)
	{
		dFree ((*classes)[i], sizeof (dxGeomClass));
	}

	dFree (classes, sizeof(dArrayBase));
	dFree (colliders, sizeof(dArrayBase)); 
}

I'm calling this right before my app exits, and the 'leaks' go away.  I
realize they're not really significant, but I just hate seeing 'memory
leaks detected' after I close my app.

Nate Waddoups
Redmond WA USA
http://www.natew.com