diff --git a/Common/Gmsh.cpp b/Common/Gmsh.cpp
index c4a1449a929ff932312ce8a23e38f489a7cb368d..c4c7324780a567c40a48361f53d3376932e856a7 100644
--- a/Common/Gmsh.cpp
+++ b/Common/Gmsh.cpp
@@ -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;
 }
 
diff --git a/Post/PViewData.cpp b/Post/PViewData.cpp
index 903f860471874bcd2f5c124fd8f3792e9a3ea5d2..f08cdf003254862c176fb0b61bfc2508401ca1de 100644
--- a/Post/PViewData.cpp
+++ b/Post/PViewData.cpp
@@ -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)
 {
diff --git a/Post/PViewData.h b/Post/PViewData.h
index 9a90bcd74f7987f774742666beb1e65ae1341ffa..085958010dc9bd50be7e9509f574f69d03727ba5 100644
--- a/Post/PViewData.h
+++ b/Post/PViewData.h
@@ -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();}