tickcallback memory leak in 2.75 ? works fine with 2.73

otan
Posts: 2
Joined: Tue Jan 06, 2009 10:41 pm

tickcallback memory leak in 2.75 ? works fine with 2.73

Post by otan »

Hi there,
I have discovered that my tickcallback is unstable in 2.75 and works perfectly fine with 2.73.
In 2.75 i get sometimes huge contact numbers back > 65000 or = max Int , which should be normaly below <10.
Right after this my userPointers in my collisionObject seem to be invalid. I can't even catch them since they seem to be pointing somewhere.

Same code works fine with 2.73 and none of these issues are present.
I am using more than 3000 Rigidbodies and more than 3000 Constraints.
Did something changed in 2.75 ? I might be missing something.
I debugged my own code and i can't see anything wrong, in addition it works fine with 2.73.
Any suggestions or tips ?

Code: Select all

static void myTickCallBack(btDynamicsWorld *world, btScalar timeStep ){  

  
  int numManifolds = world->getDispatcher()->getNumManifolds(); 
  
  fxDynSolver *mySolver=NULL;
  mySolver=static_cast<fxDynSolver*>(world->getWorldUserInfo());
  if(mySolver!=NULL){
    mySolver->simulate();
  }
  
  
  for (unsigned int i=0;i<numManifolds;i++){
    
    btPersistentManifold* contactManifold = NULL;
    contactManifold=world->getDispatcher()->getManifoldByIndexInternal(i);
    
    btCollisionObject* obA = NULL;
    
    if(contactManifold!=NULL)
      obA=static_cast<btCollisionObject*>(contactManifold->getBody0());
    
    btCollisionObject* obB = NULL;
    
    if(contactManifold!=NULL)
      obB=static_cast<btCollisionObject*>(contactManifold->getBody1());
    
    
    unsigned int  numContacts = 0;
    
    if(contactManifold!=NULL)
      numContacts=contactManifold->getNumContacts(); // <- numContacts returned are sometimes max Int value
    

  
    
    
    
    
    fxDynRigidBody *bodyA=NULL;
    fxDynRigidBody *bodyB=NULL;
    
    
    
    if((numContacts>0)&&(obA!=NULL)&&(obB!=NULL)){
      
      bodyA = static_cast<fxDynRigidBody*>(obA->getUserPointer()); // <- userPointer is invalid, after numContacts are insanely high
      bodyB = static_cast<fxDynRigidBody*>(obB->getUserPointer()); 
      
      
      
      if((bodyA!=NULL)&&(bodyB!=NULL))
	if((bodyA->isDisabled() == false) && (bodyB->isDisabled() == false) && (bodyB!=NULL)&&(bodyA!=NULL) ){ 
	
	bodyA->addCollision();
	if(bodyA->isStatic()) 
	  if(bodyA->isAutoActive()){
	
	
	    bodyA->enableActiveDynamics();
	    bodyA->notifyRigidPool();
	
	
	      
	  }
	
	
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: tickcallback memory leak in 2.75 ? works fine with 2.73

Post by Erwin Coumans »

A contact manifold can only have 0, 1,2,3 or 4 points, anything other value is wrong.

It is not clear what is going wrong in your case, can you make sure you re-compile everything and try to track it down in debug mode?
Thanks,
Erwin
otan
Posts: 2
Joined: Tue Jan 06, 2009 10:41 pm

Re: tickcallback memory leak in 2.75 ? works fine with 2.73

Post by otan »

ok will do ! need to deliver some work first and then start right away with the debug process.
Should i post it here or do you want me to send the results somewhere else ?

best
olc.