[ODE] patch: dxTriMesh::ClearTCCache memleak
Aras Pranckevicius
nearaz at interamotion.com
Mon Oct 20 15:03:41 MST 2003
Hi,
TriMesh for temporal coherence uses ODE's dArray of SphereTC and BoxTC
classes. These in turn are derived from OPCODE classes, and contain
IceCore::Container that has a non-trivial destructor.
Now, dxTriMesh::ClearTCCache uses dArray's setSize(0) to clear the caches -
but the destructor isn't called. So, each ClearTCCache leaks previous
caches' containers.
A quick dirty fix is to call destructors by hand:
void dxTriMesh::ClearTCCache(){
int i, n;
n = SphereTCCache.size();
for( i = 0; i < n; ++i ) {
SphereTCCache[i].~SphereTC();
}
SphereTCCache.setSize(0);
n = BoxTCCache.size();
for( i = 0; i < n; ++i ) {
BoxTCCache[i].~BoxTC();
}
BoxTCCache.setSize(0);
}
Aras Pranckevicius aka NeARAZ
http://www.gim.ktu.lt/nesnausk/nearaz/
More information about the ODE
mailing list