[ODE] memory leak from redundant allocation in dBodyCreate

Christoph Beyer boernerb at web.de
Sun Dec 3 14:33:52 MST 2006

I looked over the code shortly and i wonder how you got a memory leak 
from this code?

>This eventually gets to line 909 and 910 of ode.cpp which, if
>adis.average_samples > 0, allocate space for the samples.

>Then control returns to dBodyCreate which, on line 261 of ode.cpp,
>allocates space for the samples again.

in dBodyCreate(...) is no possibility to come to the lines 909 or 910.
so the space isn't allocated again.
But I would agree to your correction, because it is a safer methode,
for i.e. someone changes the code and calls dBodySetAutoDisableAverageSamplesCount(...)
in dBodySetAutoDisableDefaults(...) then the memory-leak will appear!


More information about the ODE mailing list