Skip to content

Commit 518754a

Browse files
committed
fix mem leak, fix gcc 4.8
1 parent 4d2d293 commit 518754a

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

Common/include/linear_algebra/CSysVector.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ class CSysVector : public VecExpr::CVecExpr<CSysVector<ScalarType>, ScalarType>
6767
unsigned long nElm = 0; /*!< \brief Total number of elements (or number elements on this processor). */
6868
unsigned long nElmDomain = 0; /*!< \brief Total number of elements without Ghost cells. */
6969
unsigned long nVar = 0; /*!< \brief Number of elements in a block. */
70-
mutable ScalarType dotRes = 0.0; /*!< \brief Result of dot product. to perform a reduction with OpenMP the
71-
variable needs to be declared outside the parallel region. */
7270

7371
/*!
7472
* \brief Generic initialization from a scalar or array.
@@ -101,7 +99,7 @@ class CSysVector : public VecExpr::CVecExpr<CSysVector<ScalarType>, ScalarType>
10199
/*!
102100
* \brief Default constructor of the class.
103101
*/
104-
CSysVector() {}
102+
CSysVector() = default;
105103

106104
/*!
107105
* \brief Destructor
@@ -291,8 +289,10 @@ class CSysVector : public VecExpr::CVecExpr<CSysVector<ScalarType>, ScalarType>
291289
*/
292290
template <class T>
293291
ScalarType dot(const VecExpr::CVecExpr<T, ScalarType>& expr) const {
292+
static ScalarType dotRes;
294293
/*--- All threads get the same "view" of the vectors and shared variable. ---*/
295294
SU2_OMP_BARRIER
295+
SU2_OMP_MASTER
296296
dotRes = 0.0;
297297
SU2_OMP_BARRIER
298298

SU2_CFD/include/numerics_simd/flow/diffusion/viscous_fluxes.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class CCompressibleViscousFluxBase : public CNumericsSIMD {
9191
*/
9292
template<class... Ts>
9393
CCompressibleViscousFluxBase(const CConfig& config, int iMesh,
94-
const CVariable* turbVars_ = nullptr, Ts&...) :
94+
const CVariable* turbVars_, Ts&...) :
9595
gamma(config.GetGamma()),
9696
gasConst(config.GetGas_ConstantND()),
9797
prandtlLam(config.GetPrandtl_Lam()),

SU2_CFD/src/solvers/CEulerSolver.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,7 @@ CEulerSolver::~CEulerSolver(void) {
670670

671671
void CEulerSolver::InstantiateEdgeNumerics(const CSolver* const* solver_container, const CConfig* config) {
672672

673+
SU2_OMP_BARRIER
673674
SU2_OMP_MASTER {
674675

675676
if (config->Low_Mach_Correction())

0 commit comments

Comments
 (0)