mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-29 10:21:54 -06:00
#11258 Grid Calculation: Unintended release of result data memory
Avoid release of memory when working on a single case
This commit is contained in:
parent
406cd087e9
commit
9f96cb9694
@ -609,10 +609,13 @@ std::vector<double> RimGridCalculation::getDataForResult( const QString&
|
||||
values[i] = resultAccessor->cellScalarGlobIdx( activeReservoirCells[i] );
|
||||
}
|
||||
|
||||
auto categoriesToExclude = { RiaDefines::ResultCatType::GENERATED };
|
||||
if ( m_releaseMemoryAfterDataIsExtracted )
|
||||
{
|
||||
auto categoriesToExclude = { RiaDefines::ResultCatType::GENERATED };
|
||||
|
||||
sourceCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->freeAllocatedResultsData( categoriesToExclude, timeStepToUse );
|
||||
sourceCase->results( RiaDefines::PorosityModelType::FRACTURE_MODEL )->freeAllocatedResultsData( categoriesToExclude, timeStepToUse );
|
||||
sourceCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->freeAllocatedResultsData( categoriesToExclude, timeStepToUse );
|
||||
sourceCase->results( RiaDefines::PorosityModelType::FRACTURE_MODEL )->freeAllocatedResultsData( categoriesToExclude, timeStepToUse );
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
@ -782,6 +785,9 @@ bool RimGridCalculation::calculateForCases( const std::vector<RimEclipseCase*>&
|
||||
m_expression().contains( "min" ) || m_expression().contains( "max" ) ||
|
||||
m_expression().contains( "count" );
|
||||
|
||||
// If multiple cases are present, release memory after data is extracted to avoid memory issues.
|
||||
m_releaseMemoryAfterDataIsExtracted = isMultipleCasesPresent;
|
||||
|
||||
if ( isMultipleCasesPresent )
|
||||
{
|
||||
QString txt = "Starting calculation '" + description() + "' for " + QString::number( calculationCases.size() ) + " cases.";
|
||||
|
@ -155,4 +155,6 @@ private:
|
||||
caf::PdmField<bool> m_editNonVisibleResultAddress;
|
||||
|
||||
caf::PdmField<bool> m_applyToAllCases_OBSOLETE;
|
||||
|
||||
bool m_releaseMemoryAfterDataIsExtracted = false;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user