Skip to content
Snippets Groups Projects
Commit 11c4d482 authored by Michel Rasquin's avatar Michel Rasquin
Browse files

Fix for clean memory deallocation

parent 50c81fbe
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,7 @@
#include "robustPredicates.h"
#if defined(HAVE_POST)
#include "PView.h"
#include "PViewData.h"
#endif
#if defined(HAVE_ONELAB) && !defined(HAVE_ONELAB2)
......@@ -230,10 +231,18 @@ int GmshWriteFile(const std::string &fileName)
int GmshFinalize()
{
#if defined(HAVE_POST)
// Delete all PViewData stored in static PView list
for(unsigned int i = 0; i < PView::list.size(); i++) {
delete PView::list[i];
}
PView::list.clear();
// Delete static interpolationSchemes
PViewData::removeAllInterpolationSchemes();
#endif
// Delete all Gmodels
for(unsigned int i = 0; i < GModel::list.size(); i++)
delete GModel::list[i];
GModel::list.clear();
CTX::instance()->files.clear();
return 1;
}
......
......@@ -196,6 +196,17 @@ void PViewData::removeInterpolationScheme(const std::string &name)
}
}
void PViewData::removeAllInterpolationSchemes()
{
std::map<std::string, interpolationMatrices>::iterator it = _interpolationSchemes.begin();
for(;it!=_interpolationSchemes.end();it++)
for(interpolationMatrices::iterator it2 = it->second.begin();
it2 != it->second.end(); it2++)
for(unsigned int i = 0; i < it2->second.size(); i++)
delete it2->second[i];
_interpolationSchemes.clear();
}
void PViewData::addMatrixToInterpolationScheme(const std::string &name, int type,
fullMatrix<double> &mat)
{
......
......@@ -228,6 +228,7 @@ class PViewData {
// access to global interpolation schemes
static void removeInterpolationScheme(const std::string &name);
static void removeAllInterpolationSchemes();
static void addMatrixToInterpolationScheme(const std::string &name, int type,
fullMatrix<double> &mat);
static int getSizeInterpolationScheme() {return _interpolationSchemes.size();}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment