mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fixed Memory bug regarding statistics calcualtion
The results memory on each timestep was not freed resulting in all the data from all the cases for all timesteps in memory at the same time ... In addition, the data was read accidentaly before the timeloop for all the source cases for all timesteps. So, should perform better now, but there still are some memory allocated in the start, that i cant quite account for. p4#: 22011
This commit is contained in:
@@ -521,6 +521,24 @@ void RigCaseCellResultsData::clearAllResults()
|
||||
m_resultInfos.clear();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Removes all the actual numbers put into this object, and frees up the memory.
|
||||
/// Does not touch the metadata in any way
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigCaseCellResultsData::freeAllocatedResultsData()
|
||||
{
|
||||
for (size_t resultIdx = 0; resultIdx < m_cellScalarResults.size(); ++resultIdx)
|
||||
{
|
||||
for (size_t tsIdx = 0; tsIdx < m_cellScalarResults[resultIdx].size(); ++tsIdx)
|
||||
{
|
||||
// Using swap with an empty vector as that is the safest way to really get rid of the allocated data in a vector
|
||||
std::vector<double> empty;
|
||||
m_cellScalarResults[resultIdx][tsIdx].swap(empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Add a result with given type and name, and allocate one result vector for the static result values
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user