Menu

#265 Fix the memory leak bug with variable values

Version 5.10
closed
None
5
2013-12-19
2013-11-06
No

The following comment is in several places in the code:

// BUG - These can not currenrtly be deleted. 
// The code is no consistant here. In places a new vector is returned
// in others a reference to a vector that is managed by other code is returned.
//delete tmp;
//tmp = NULL;

This needs to be cleaned up so that memory doesn't leak.

Discussion

  • Michael Chisholm

    Some code to address this issue was contributed:

    VariableValueVector* ObjectComponent::GetVariableValues() 
    {
        VariableValueVector* values = NULL;
        if(AbsDataCollector::GetIsRunning()) 
        {
            values = new VariableValueVector();
            CollectedObject* collectedObject = AbsObjectCollector::Instance()->Run(this->GetObjectId());
            *values = *(collectedObject->GetVariableValues());
        } else {
            values = ObjectReader::GetVariableValuesForObject(this->GetObjectId());
        }
    
        return values;
    }
    

    See the help forum thread https://sourceforge.net/p/ovaldi/discussion/776940/thread/61079226/#11e7

     
  • Danny Haynes

    Danny Haynes - 2013-12-19
    • status: open --> closed
    • assigned_to: Michael Chisholm
     

Log in to post a comment.