CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Invalid pointer handling in tmp%2360T class (

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,


henry April 24, 2007 12:57

Robert, I changed the opera

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 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.


All times are GMT -4. The time now is 02:46.