Salome HOME
IPAL53870: Dump study script creates an excess sub-mesh
[modules/smesh.git] / src / OBJECT / SMESH_Object.cxx
index 61b36a78c706f0b5270700ee4678bd80994a9b19..3b9cd0b8ce28e9ad97222dccbb9caa0b1c4de46f 100644 (file)
@@ -280,6 +280,7 @@ void SMESH_VisualObjDef::buildPrs(bool buildGrid)
     myLocalGrid = false;
     if (!GetMesh()->isCompacted())
     {
+      NulData(); // detach from the SMDS grid to allow immediate memory de-allocation in compactMesh()
       if ( MYDEBUG ) MESSAGE("*** buildPrs ==> compactMesh!");
       GetMesh()->compactMesh();
     }
@@ -570,6 +571,7 @@ vtkUnstructuredGrid* SMESH_VisualObjDef::GetUnstructuredGrid()
 {
   if ( !myLocalGrid && !GetMesh()->isCompacted() )
   {
+    NulData(); // detach from the SMDS grid to allow immediate memory de-allocation in compactMesh()
     GetMesh()->compactMesh();
     updateEntitiesFlags();
     vtkUnstructuredGrid *theGrid = GetMesh()->getGrid();
@@ -717,7 +719,7 @@ bool SMESH_MeshObj::NulData()
     points->SetNumberOfPoints(0);
     myEmptyGrid->SetPoints( points );
     points->Delete();
-    myEmptyGrid->BuildLinks();
+    //myEmptyGrid->BuildLinks();
   }
   myGrid->ShallowCopy(myEmptyGrid);
   return true;