diff --git a/src/OpenFOAM/dimensionSet/dimensionSets.C b/src/OpenFOAM/dimensionSet/dimensionSets.C index cb0a9ac849..d6166868c6 100644 --- a/src/OpenFOAM/dimensionSet/dimensionSets.C +++ b/src/OpenFOAM/dimensionSet/dimensionSets.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,7 @@ License #include "dimensionSet.H" #include "dimensionedScalar.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,6 +39,19 @@ dictionary* dimensionSystemsPtr_(nullptr); HashTable* unitSetPtr_(nullptr); dimensionSets* writeUnitSetPtr_(nullptr); +// Delete the above data at the end of the run +struct deleteDimensionSystemsPtr +{ + ~deleteDimensionSystemsPtr() + { + deleteDemandDrivenData(dimensionSystemsPtr_); + deleteDemandDrivenData(unitSetPtr_); + deleteDemandDrivenData(writeUnitSetPtr_); + } +}; + +deleteDimensionSystemsPtr deleteDimensionSystemsPtr_; + } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //