Search ProofOfProgress Blog

Thursday, February 11, 2016

Mem Leak detection Part 2

Revised:
uint MyClass::deleteInstance(MyClass* c){

    uint deletion_confirmation_hash = 0;
   
    //Does object OWN it's pointers?
    if(owns){
        if(owns != 3){ throw("we may own more or less pointers than this.")}
        uint num1 = OtherClass::deleteInstance(c->ptr01); // 1 //
        uint num2 = OtherClass::deleteInstance(c->ptr02); // 2 //
        uint num3 = OtherClass::deleteInstance(c->ptr03); // 3 //
        deletion_confirmation_hash+=(num1+num2+num3);
    }
   
    deletion_confirmation_hash += c.getObjectID();
   
    delete c;
    return (deletion_confirmation_hash);
   
}

No comments:

Post a Comment