Skip to content

Commit 545843f

Browse files
author
Max Aehle
committed
Store CIteration::TurbomachineryStagePerformance via shared_ptr
to fix memory leak.
1 parent fc23554 commit 545843f

6 files changed

Lines changed: 10 additions & 10 deletions

File tree

SU2_CFD/include/iteration/CIteration.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class CIteration {
6161
StopTime{0.0}, UsedTime{0.0};
6262

6363
std::shared_ptr<CTurboOutput> TurbomachineryPerformance; /*!< \brief turbo performance calculator. */
64-
CTurbomachineryStagePerformance* TurbomachineryStagePerformance; /*!< \brief turbo stage performance calculator. */
64+
std::shared_ptr<CTurbomachineryStagePerformance> TurbomachineryStagePerformance; /*!< \brief turbo stage performance calculator. */
6565

6666
public:
6767
/*!

SU2_CFD/include/output/CFlowCompOutput.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ class CFlowCompOutput final: public CFlowOutput {
109109
* \param[in] TurboPerf - Turboperformance class
110110
* \param[in] config - Definition of the particular problem
111111
*/
112-
void SetTurboMultiZonePerformance_Output(CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr<CTurboOutput> TurboPerf, CConfig *config) override;
112+
void SetTurboMultiZonePerformance_Output(std::shared_ptr<CTurbomachineryStagePerformance> TurboStagePerf, std::shared_ptr<CTurboOutput> TurboPerf, CConfig *config) override;
113113

114114
/*!
115115
* \brief Loads the turboperformacne history data
116116
* \param[in] TurboStagePerf - Stage turboperformance class
117117
* \param[in] TurboPerf - Turboperformance class
118118
* \param[in] config - Definition of the particular problem
119119
*/
120-
void LoadTurboHistoryData(CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr<CTurboOutput> TurboPerf, CConfig *config) override;
120+
void LoadTurboHistoryData(std::shared_ptr<CTurbomachineryStagePerformance> TurboStagePerf, std::shared_ptr<CTurboOutput> TurboPerf, CConfig *config) override;
121121

122122
/*!
123123
* \brief Write the kinematic and thermodynamic variables at each spanwise division

SU2_CFD/include/output/COutput.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ class COutput {
394394
* \param[in] val_iInst - Index of the instance layer
395395
*/
396396
void SetHistoryOutput(CGeometry ****geometry, CSolver *****solver_container, CConfig **config,
397-
CTurbomachineryStagePerformance* TurboStagePerf,
397+
std::shared_ptr<CTurbomachineryStagePerformance> TurboStagePerf,
398398
std::shared_ptr<CTurboOutput> TurboPerf, unsigned short val_iZone,
399399
unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter, unsigned short val_iInst);
400400

@@ -973,15 +973,15 @@ class COutput {
973973
* \param[in] TurboPerf - Turboperformance class
974974
* \param[in] config - Definition of the particular problem
975975
*/
976-
inline virtual void SetTurboMultiZonePerformance_Output(CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr<CTurboOutput> TurboPerf, CConfig *config) {}
976+
inline virtual void SetTurboMultiZonePerformance_Output(std::shared_ptr<CTurbomachineryStagePerformance> TurboStagePerf, std::shared_ptr<CTurboOutput> TurboPerf, CConfig *config) {}
977977

978978
/*!
979979
* \brief Loads the turboperformacne history data
980980
* \param[in] TurboStagePerf - Stage turboperformance class
981981
* \param[in] TurboPerf - Turboperformance class
982982
* \param[in] config - Definition of the particular problem
983983
*/
984-
inline virtual void LoadTurboHistoryData(CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr<CTurboOutput> TurboPerf, CConfig *config) {}
984+
inline virtual void LoadTurboHistoryData(std::shared_ptr<CTurbomachineryStagePerformance> TurboStagePerf, std::shared_ptr<CTurboOutput> TurboPerf, CConfig *config) {}
985985

986986
/*!
987987
* \brief Write the kinematic and thermodynamic variables at each spanwise division

SU2_CFD/src/iteration/CTurboIteration.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ void CTurboIteration::Postprocess(COutput* output, CIntegration**** integration,
6262

6363
void CTurboIteration::InitTurboPerformance(CGeometry* geometry, CConfig** config, CFluidModel* fluid) {
6464
TurbomachineryPerformance = std::make_shared<CTurboOutput>(config, *geometry, *fluid);
65-
TurbomachineryStagePerformance = new CTurbomachineryStagePerformance(*fluid);
65+
TurbomachineryStagePerformance = std::make_shared<CTurbomachineryStagePerformance>(*fluid);
6666
}

SU2_CFD/src/output/CFlowCompOutput.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ void CFlowCompOutput::SetTurboPerformance_Output(std::shared_ptr<CTurboOutput> T
545545
cout<<TurboInOutTable.str();
546546
}
547547

548-
void CFlowCompOutput::SetTurboMultiZonePerformance_Output(CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr<CTurboOutput> TurboPerf, CConfig *config) {
548+
void CFlowCompOutput::SetTurboMultiZonePerformance_Output(std::shared_ptr<CTurbomachineryStagePerformance> TurboStagePerf, std::shared_ptr<CTurboOutput> TurboPerf, CConfig *config) {
549549

550550
stringstream TurboMZPerf;
551551

@@ -575,7 +575,7 @@ void CFlowCompOutput::SetTurboMultiZonePerformance_Output(CTurbomachineryStagePe
575575

576576
}
577577

578-
void CFlowCompOutput::LoadTurboHistoryData(CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr<CTurboOutput> TurboPerf, CConfig *config) {
578+
void CFlowCompOutput::LoadTurboHistoryData(std::shared_ptr<CTurbomachineryStagePerformance> TurboStagePerf, std::shared_ptr<CTurboOutput> TurboPerf, CConfig *config) {
579579
auto BladePerformance = TurboPerf->GetBladesPerformances();
580580
for (unsigned short iZone = 0; iZone <= config->GetnZone()-1; iZone++) {
581581
auto nSpan = config->GetnSpan_iZones(iZone);

SU2_CFD/src/output/COutput.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ void COutput::SetHistoryOutput(CGeometry *geometry,
227227

228228
}
229229

230-
void COutput::SetHistoryOutput(CGeometry ****geometry, CSolver *****solver, CConfig **config, CTurbomachineryStagePerformance* TurboStagePerf, std::shared_ptr<CTurboOutput> TurboPerf, unsigned short val_iZone, unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter, unsigned short val_iInst){
230+
void COutput::SetHistoryOutput(CGeometry ****geometry, CSolver *****solver, CConfig **config, std::shared_ptr<CTurbomachineryStagePerformance>(TurboStagePerf), std::shared_ptr<CTurboOutput> TurboPerf, unsigned short val_iZone, unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter, unsigned short val_iInst){
231231

232232
unsigned long Iter= InnerIter;
233233

0 commit comments

Comments
 (0)