Memory Leaks in Soft Body

Zurzaza
Posts: 11
Joined: Tue Aug 24, 2010 9:34 pm

Memory Leaks in Soft Body

Post by Zurzaza »

Hi all, I've got a new problem while implementing soft bodies into my world:

SoftBody initialize:

Code: Select all

m_softBody = btSoftBodyHelpers::CreateFromTriMesh(world->getSoftBodyWorldInfo(),gVertices,&gIndices[0][0],NUM_TRIANGLES);
If the world closes while the object is not colliding with a rigid body, nothing happens. Memory will be cleaned correctly and the program will close without leaks.
But if the softbody is colliding (i.e standing on a box) with a rigid body, the program will leave some memory leaks..
I dumped it with VLD and there are about 50 equal memory leaks.

Code: Select all

---------- Block 1576 at 0x046C97C8: 284 bytes ----------
  Call Stack:
    HINT: The following call stack may be incomplete. Setting "StackWalkMethod"
      in the vld.ini file to "safe" instead of "fast" may result in a more
      complete stack trace.
    0x00566320 (File and line number not available): ?Evaluate@?$btSparseSdf@$02@@QAEMABVbtVector3@@PAVbtCollisionShape@@AAV2@M@Z
    0x0056C8B7 (File and line number not available): ?checkContact@btSoftBody@@QBE_NPAVbtCollisionObject@@ABVbtVector3@@MAAUsCti@1@@Z
    0x0056FEE1 (File and line number not available): ?DoNode@CollideSDF_RS@btSoftColliders@@QBEXAAUNode@btSoftBody@@@Z
    0x00579B27 (File and line number not available): ??$collideTV@UCollideSDF_RS@btSoftColliders@@@btDbvt@@QAEXPBUbtDbvtNode@@ABUbtDbvtAabbMm@@AAUCollideSDF_RS@btSoftColliders@@@Z
    0x0057AE0C (File and line number not available): ?defaultCollisionHandler@btSoftBody@@QAEXPAVbtCollisionObject@@@Z
    0x00582234 (File and line number not available): ?processCollision@btSoftRigidCollisionAlgorithm@@UAEXPAVbtCollisionObject@@0ABUbtDispatcherInfo@@PAVbtManifoldResult@@@Z
    0x0050C0F5 (File and line number not available): ?processOverlap@btCollisionPairCallback@@UAE_NAAUbtBroadphasePair@@@Z
    0x025858AC (File and line number not available): (Function name unavailable)
I putted

Code: Select all

m_worldInfo.m_sparsesdf.GarbageCollect();
every step simulation and before closing the bullet' device but the memory leaks still remain.

Any Idea?
Zurzaza
Posts: 11
Joined: Tue Aug 24, 2010 9:34 pm

Re: Memory Leaks in Soft Body

Post by Zurzaza »

I tried to put

Code: Select all

m_worldInfo.m_sparsesdf.Reset();
before closing the bullet "device" and it seems all ok now...is this a good method to clean the memory or what else?
Thank you...