CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Invalid pointer handling in tmp%2360T class (https://www.cfd-online.com/Forums/openfoam/60930-invalid-pointer-handling-tmp-2360t-class.html)

mbeaudoin April 23, 2007 16:02

Any comments anyone? Should
 
Any comments anyone?

Should we be worried about this potential problem in a fairly low-level but very important class for OpenFOAM?

Is it possible to know what kind of problem was solved by this modification to the file tmpI.H?

Should we reactivate the little piece of code commented out in tmp<t>::clear()?

Just curious,

Martin

henry April 24, 2007 12:57

Robert, I changed the opera
 
Robert,

I changed the operation of tmp::clear() for the 1.3 release to force the clearance of temporary objects at the bottom of call-chains irrespective of their reference count, which should be valid if they really are temporary. This improved the storage efficiency of OpenFOAM and hasn't caused any problems so far. Objects for which clearance in this manner is not allowable should not be created as temporaries.

However, I wasn't careful in the handling of assignments to temporaries (not something we do very often in OpenFOAM codes) and your test code does flag-up a problem. Here is a new version of http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif tmpI.H with a corrected handling of object clearance on assignment which solves the problem for your test code and which I now have running in our OpenFOAM test-loop under valgrind.

Henry


All times are GMT -4. The time now is 14:58.