[ODE] memory leak from redundant allocation in dBodyCreate
rileylark at gmail.com
Sun Dec 3 22:19:38 MST 2006
dBodyCreate calls dBodySetAutoDisableDefaults on line 254, which in
turn calls dBodySetAutoDisableFlag on line 984, which then calls
dBodySetAutoDisableAverageSamplesCount on line 969 as long as
!do_auto_disable is true. This leads to line 909 and 910.
On 12/3/06, Christoph Beyer <boernerb at web.de> wrote:
> 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!
> ODE mailing list
> ODE at q12.org
More information about the ODE