Salome HOME
21948: EDF SMESH : Memory is not freed when deleting a mesh
authoreap <eap@opencascade.com>
Fri, 14 Dec 2012 13:21:56 +0000 (13:21 +0000)
committereap <eap@opencascade.com>
Fri, 14 Dec 2012 13:21:56 +0000 (13:21 +0000)
 Delete SMESHDS_Document's at destruction

src/SMESH/SMESH_Gen.cxx

index 95013c9d49092b18f860391c1d920a298bac4596..58b649bf7a285e62a12b036522648c8e44b014a1 100644 (file)
@@ -53,6 +53,9 @@
 
 using namespace std;
 
+//#include <vtkDebugLeaks.h>
+
+
 //=============================================================================
 /*!
  *  Constructor
@@ -67,11 +70,12 @@ SMESH_Gen::SMESH_Gen()
         _segmentation = _nbSegments = 10;
         SMDS_Mesh::_meshList.clear();
         MESSAGE(SMDS_Mesh::_meshList.size());
-        _counters = new counters(100);
+        //_counters = new counters(100);
 #ifdef WITH_SMESH_CANCEL_COMPUTE
         _compute_canceled = false;
         _sm_current = NULL;
 #endif
+        //vtkDebugLeaks::SetExitError(0);
 }
 
 //=============================================================================
@@ -83,6 +87,12 @@ SMESH_Gen::SMESH_Gen()
 SMESH_Gen::~SMESH_Gen()
 {
   MESSAGE("SMESH_Gen::~SMESH_Gen");
+  std::map < int, StudyContextStruct * >::iterator i_sc = _mapStudyContext.begin();
+  for ( ; i_sc != _mapStudyContext.end(); ++i_sc )
+  {
+    delete i_sc->second->myDocument;
+    delete i_sc->second;
+  }  
 }
 
 //=============================================================================