]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
VISU memory management debugging RTV_debug_01
authorenk <enk@opencascade.com>
Tue, 22 Mar 2005 12:19:16 +0000 (12:19 +0000)
committerenk <enk@opencascade.com>
Tue, 22 Mar 2005 12:19:16 +0000 (12:19 +0000)
13 files changed:
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_Convertor_impl.hxx
src/OBJECT/VISU_Actor.cxx
src/OBJECT/VISU_MeshAct.cxx
src/OBJECT/VISU_MeshAct.h
src/OBJECT/VISU_ScalarMapAct.cxx
src/PIPELINE/VISU_CutPlanesPL.cxx
src/PIPELINE/VISU_DeformedShapePL.cxx
src/PIPELINE/VISU_PipeLine.cxx
src/PIPELINE/VISU_ScalarMapPL.cxx
src/PIPELINE/VISU_UsedPointsFilter.cxx
src/VISU_I/VISU_Result_i.cc
src/VISU_I/VISU_ScalarMap_i.cc

index 5fcb2f9e5983cc7236200e4369ca021d2115d0c3..7e8ca43cdb0b7a3585465ba0635c715f8767b3f2 100644 (file)
@@ -52,6 +52,14 @@ static float ERR_SIZE_CALC = 1.00;
 
 static int MYVTKDEBUG = 0;
 
+// VTK Debug for structures
+static int MYVTKDEBUG_TMESHIMPL = 0;
+static int MYVTKDEBUG_TMESHONENTITYIMPL =  0;
+static int MYVTKDEBUG_TFAMILYIMPL = 0;
+static int MYVTKDEBUG_TGROUPIMPL = 0;
+static int MYVTKDEBUG_TFIELDIMPL = 0;
+static int MYVTKDEBUG_TVALFORTIMEIMPL = 0;
+
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 static int MYDEBUGWITHFILES = 0;
@@ -207,6 +215,7 @@ namespace{
                          aCoordHelperPtr->GetCoord(i,eY),
                          aCoordHelperPtr->GetCoord(i,eZ));
       theMesh->myPoints = aPoints;
+      aPoints->Delete();
     }
     theStorage->SetPoints(aPoints);
   }
@@ -439,8 +448,11 @@ namespace{
       aFloatArray->SetNumberOfComponents(3);
       aDataSetAttributes->SetVectors(aFloatArray);
     }
-
+    
+    aFloatArray->Delete();
+    
     GetValsOnTimeStamp(aFloatArray,aNumberOfTuples,aFieldName,theField,theValForTime);
+    //aFloatArray->DebugOn();
   }
 
   void GetTimeStamp(VISU::TVTKAttribyteFilter& theAttribyteFilter,
@@ -494,6 +506,78 @@ namespace{
   }
 }
 
+VISU::TMeshImpl::~TMeshImpl(){
+  if(MYVTKDEBUG_TMESHIMPL){
+    MSG(MYVTKDEBUG_TMESHIMPL,"VISU::TMeshImpl::~TMeshImpl() this="<<this);
+
+    if (myPoints.GetPointer()) myPoints->DebugOn();
+    else MSG(MYVTKDEBUG_TMESHIMPL,"myPoints is NULL pointer");
+
+    MSG(MYVTKDEBUG_TMESHIMPL,"VISU::TMeshImpl::~TMeshImpl() OK");
+  }
+}
+
+VISU::TMeshOnEntityImpl::~TMeshOnEntityImpl(){
+  if(MYVTKDEBUG_TMESHONENTITYIMPL){
+    MSG(MYVTKDEBUG_TMESHONENTITYIMPL,"VISU::TMeshOnEntityImpl::~TMeshOnEntityImpl() this="<<this);
+
+    if (myStorage.GetPointer()) myStorage->DebugOn();
+    else MSG(MYVTKDEBUG_TMESHONENTITYIMPL,"myStorage is NULL pointer");
+
+    MSG(MYVTKDEBUG_TMESHONENTITYIMPL,"VISU::TMeshOnEntityImpl::~TMeshOnEntityImpl() OK");
+  }
+}
+
+VISU::TFamilyImpl::~TFamilyImpl(){
+  if(MYVTKDEBUG_TFAMILYIMPL){
+    MSG(MYVTKDEBUG_TFAMILYIMPL,"VISU::TFamilyImpl::~TFamilyImpl() this="<<this);
+
+    if (myStorage.GetPointer()) myStorage->DebugOn();
+    else MSG(MYVTKDEBUG_TFAMILYIMPL,"myStorage is NULL pointer");
+
+    MSG(MYVTKDEBUG_TFAMILYIMPL,"VISU::TFamilyImpl::~TFamilyImpl() OK");
+  }
+}
+
+VISU::TGroupImpl::~TGroupImpl(){
+  if(MYVTKDEBUG_TGROUPIMPL){
+    MSG(MYVTKDEBUG_TGROUPIMPL,"VISU::TGroupImpl::~TGroupImpl() this="<<this);
+
+    if (myStorage.GetPointer()) myStorage->DebugOn();
+    else MSG(MYVTKDEBUG_TGROUPIMPL,"myStorage is NULL pointer");
+
+    MSG(MYVTKDEBUG_TGROUPIMPL,"VISU::TGroupImpl::~TGroupImpl() OK");
+  }
+}
+
+VISU::TFieldImpl::~TFieldImpl(){
+  if(MYVTKDEBUG_TFIELDIMPL){
+    MSG(MYVTKDEBUG_TFIELDIMPL,"VISU::TFieldImpl::~TFieldImpl() this="<<this);
+
+    if (myExtractFilter.GetPointer()) myExtractFilter->DebugOn();
+    else MSG(MYVTKDEBUG_TFIELDIMPL,"myExtractFilter is NULL pointer");
+
+    MSG(MYVTKDEBUG_TFIELDIMPL,"VISU::TFieldImpl::~TFieldImpl() OK");
+  }
+}
+
+VISU::TValForTimeImpl::~TValForTimeImpl(){
+  if(MYVTKDEBUG_TVALFORTIMEIMPL){
+    MSG(MYVTKDEBUG_TVALFORTIMEIMPL,"VISU::TValForTimeImpl::~TValForTimeImpl() this="<<this);
+    
+    if (myAttribyteFilter.GetPointer()) myAttribyteFilter->DebugOn();
+    else MSG(MYVTKDEBUG_TVALFORTIMEIMPL,"myAttribyteFilter is NULL pointer");
+    
+    if (myMergeFilter.GetPointer()) myMergeFilter->DebugOn();
+    else MSG(MYVTKDEBUG_TVALFORTIMEIMPL,"myMergeFilter is NULL pointer");
+    
+    if (myStorage.GetPointer()) myStorage->DebugOn();
+    else MSG(MYVTKDEBUG_TVALFORTIMEIMPL,"myStorage is NULL pointer");
+    
+    MSG(MYVTKDEBUG_TVALFORTIMEIMPL,"VISU::TValForTimeImpl::~TValForTimeImpl() OK");
+  }
+}
+
 VISU_Convertor_impl::VISU_Convertor_impl() {
   myIsDone = false;
 }
@@ -548,7 +632,12 @@ VISU_Convertor_impl::GetMeshOnEntity(const string& theMeshName,
       MSG(MYVTKDEBUG,"GetMeshOnEntity - GetCellLinks() = "<<float(aDataSet->GetCellLinks()->GetActualMemorySize()*1000));
       MSG(MYVTKDEBUG,"GetMeshOnEntity - GetActualMemorySize() = "<<float(aDataSet->GetActualMemorySize()*1000));
     }
+  }catch(std::exception& exc){
+    MSG(1,"Follow exception was occured :\n"<<exc.what());
+    aSource = vtkSmartPointerBase();
+    throw;
   }catch(...){
+    MSG(1,"Unknown exception was occured!");
     aSource = vtkSmartPointerBase();
     throw;
   }
index 46284cba0cab26d047f6b2bc59202fec10e5121e..ff8c443bef0c8a601da7a1d57f76768d617b64b9 100644 (file)
@@ -44,6 +44,7 @@ namespace VISU{
 
     typedef std::vector<std::string> TPointsDim;
     TPointsDim myPointsDim;
+    ~TMeshImpl();
   };
   typedef shared_ptr<TMeshImpl> PMeshImpl;
 
@@ -53,6 +54,7 @@ namespace VISU{
     typedef std::vector<TConnect> TConnForCellType;
     typedef std::map<vtkIdType,TConnForCellType> TCellsConn;
     TCellsConn myCellsConn;
+    ~TMeshOnEntityImpl();
   };
   typedef shared_ptr<TMeshOnEntityImpl> PMeshOnEntityImpl;
 
@@ -62,21 +64,20 @@ namespace VISU{
     typedef std::set<vtkIdType> TSubMeshOnCellType;
     typedef std::map<vtkIdType,TSubMeshOnCellType> TSubMesh;
     TSubMesh mySubMesh;
+    ~TFamilyImpl();
   };
   typedef shared_ptr<TFamilyImpl> PFamilyImpl;
 
   struct TGroupImpl: TGroup{
     TVTKSource myStorage;
+    ~TGroupImpl();
   };
   typedef shared_ptr<TGroupImpl> PGroupImpl;
 
   struct TFieldImpl: TField{
     TVTKExtractFilter myExtractFilter;
-    ~TFieldImpl()
-    { 
-      if(myExtractFilter.GetPointer())
-       myExtractFilter->UnRegisterAllOutputs();
-    }
+    ~TFieldImpl();
+
   };
   typedef shared_ptr<TFieldImpl> PFieldImpl;
 
@@ -89,13 +90,7 @@ namespace VISU{
     typedef std::map<vtkIdType,TValForCellsWithType> TValForCells;
     TValForCells myValForCells;
 
-    ~TValForTimeImpl()
-    { 
-      if(myMergeFilter.GetPointer())
-       myMergeFilter->UnRegisterAllOutputs();
-      if(myAttribyteFilter.GetPointer())
-       myAttribyteFilter->UnRegisterAllOutputs();
-    }
+    ~TValForTimeImpl();
   };
   typedef shared_ptr<TValForTimeImpl> PValForTimeImpl;
 
index d26af3b9bae2171a4753b8f9e99bcec9a57cc806..506e0ee082a6765d263c1aaf28163facaff33dc0 100644 (file)
@@ -85,15 +85,20 @@ VISU_Actor::VISU_Actor(){
 }
 
 VISU_Actor::~VISU_Actor(){
+  if (MYVTKDEBUG){
+    MESSAGE("VISU_Actor::~VISU_Actor()");
+    myParent->DebugOn();
+    myPipeLine->DebugOn();
+    myMapper->DebugOn();
+    myShrinkFilter->DebugOn();
+  }
   SALOME_Actor::SetProperty(NULL);
 
-  myMapper->RemoveAllInputs();
   myMapper->Delete();
 
   if(myPipeLine) 
     myPipeLine->UnRegister(this);
-
-  myShrinkFilter->UnRegisterAllOutputs();
+  
   myShrinkFilter->Delete();
 }
 
index ac262e529002d65aa946b27fc023d26ae5824899..2d8b6367031875c0f45706a054373feb4fe82d39 100644 (file)
@@ -39,6 +39,8 @@
 #include <vtkMatrix4x4.h>
 #include <vtkMapperCollection.h> 
 
+static int MYVTKDEBUG = 0;
+
 vtkStandardNewMacro(VISU_MeshAct);
 
 VISU_MeshAct::VISU_MeshAct(){
@@ -75,6 +77,12 @@ VISU_MeshAct::VISU_MeshAct(){
 }
 
 VISU_MeshAct::~VISU_MeshAct(){
+  if (MYVTKDEBUG){
+    MESSAGE("VISU_MeshAct::~VISU_MeshAct()");
+    mySurfaceActor->DebugOn();
+    myEdgeActor->DebugOn();
+    myNodeActor->DebugOn();
+  }
   mySurfaceActor->Delete();
   myEdgeActor->Delete();
   myNodeActor->Delete();
index 6530c7a28ceacf36380db1828757103d3d1b6182..f1504a0153daa4ab703167fddc709405dc97d17c 100644 (file)
@@ -81,3 +81,7 @@ class VTKOCC_EXPORT VISU_MeshAct : public VISU_Actor {
 };
 
 #endif
+
+#ifndef MESSAGE
+#define MESSAGE(msg) std::cout<<__FILE__<<"["<<__LINE__<<"]::"<<msg<<endl
+#endif
index 01449f79b21e3d63a93c441610c1868223ca1c8f..9eb41effdfe90e2577d07f0bf527104580a988f3 100644 (file)
@@ -33,6 +33,8 @@
 #include <vtkObjectFactory.h>
 #include <vtkRenderer.h>
 
+static int MYVTKDEBUG = 0;
+
 vtkStandardNewMacro(VISU_ScalarMapAct);
 
 VISU_ScalarMapAct::VISU_ScalarMapAct(){
@@ -50,6 +52,10 @@ VISU_ScalarMapAct::VISU_ScalarMapAct(){
 }
 
 VISU_ScalarMapAct::~VISU_ScalarMapAct(){
+  if(MYVTKDEBUG){
+    cout <<__FILE__<<"["<<__LINE__<<"]::"<<"VISU_ScalarMapAct::~VISU_ScalarMapAct()"<<endl;
+    myScalarBar->DebugOn();
+  }
   myScalarBar->Delete();
 }
 
index be8925f440a151f47dfd23e2980cd5254935c1b6..e71f2234881aced8947c641a040ec5fb8156a59a 100644 (file)
@@ -36,6 +36,7 @@
 using namespace std;
 
 static float EPS = 1.0E-3;
+static int MYVTKDEBUG = 0;
 
 vtkStandardNewMacro(VISU_CutPlanesPL);
 
@@ -44,6 +45,10 @@ VISU_CutPlanesPL::VISU_CutPlanesPL(){
 }
 
 VISU_CutPlanesPL::~VISU_CutPlanesPL(){
+  if (MYVTKDEBUG){
+    MESSAGE("VISU_CutPlanesPL::~VISU_CutPlanesPL()");
+    myAppendPolyData->DebugOn();
+  }
   myAppendPolyData->Delete();
 }
 
@@ -276,9 +281,10 @@ void VISU_CutPlanesPL::CutWithPlane(vtkAppendPolyData* theAppendPolyData,
   aPlane->SetNormal(theDir);
   aCutPlane->SetCutFunction(aPlane);
   aPlane->Delete();
+  if(MYVTKDEBUG) aPlane->DebugOn();
   theAppendPolyData->AddInput(aCutPlane->GetOutput());
-  aCutPlane->Register(theAppendPolyData);
   aCutPlane->Delete();
+  if(MYVTKDEBUG) aCutPlane->DebugOn();
 }
 
 
index 9b200331a11350a366748ed4aa4ae466eb48accf..00f51085bf48e1ec8298df0e9b579c54510063c7 100644 (file)
 
 #include <vtkWarpVector.h>
 
+static int MYVTKDEBUG = 0;
+
 #ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
 #endif
@@ -45,10 +47,12 @@ VISU_DeformedShapePL::VISU_DeformedShapePL(){
 }
 
 VISU_DeformedShapePL::~VISU_DeformedShapePL(){
-  myWarpVector->UnRegisterAllOutputs();
+  if(MYVTKDEBUG){
+    MESSAGE("VISU_DeformedShapePL::~VISU_DeformedShapePL()");
+    myWarpVector->DebugOn();
+    myCellDataToPointData->DebugOn();
+  }
   myWarpVector->Delete();
-
-  myCellDataToPointData->UnRegisterAllOutputs();
   myCellDataToPointData->Delete();
 }
 
index a99eba600854ef89c7862149f1f4326069aadd86..acc496b1f8f794d63bb559689def357362a9e963 100644 (file)
@@ -54,7 +54,10 @@ VISU_PipeLine::VISU_PipeLine(){
 VISU_PipeLine::~VISU_PipeLine(){
   if(MYDEBUG) MESSAGE("~VISU_PipeLine - myInput = "<<myInput->GetReferenceCount());
   SetInput(NULL);
-  myMapper->RemoveAllInputs();
+  if(MYVTKDEBUG){
+    MESSAGE("VISU_PipeLine::~VISU_PipeLine()");
+    myMapper->DebugOn();
+  }
   myMapper->Delete();
 }
 
@@ -66,7 +69,10 @@ void VISU_PipeLine::ShallowCopy(VISU_PipeLine *thePipeLine){
 
 void VISU_PipeLine::SetInput(TInput* theInput){
   if(myInput != theInput){
-    if (myInput != NULL) myInput->UnRegister(this);
+    if (myInput != NULL) {
+      if(MYVTKDEBUG) myInput->DebugOn();
+      myInput->UnRegister(this);
+    }
     myInput = theInput;
     if(myInput != NULL){
       myInput->Register(this);
index d7b7b4a6f43f1a7d7cbd8344423b7d25774c7725..d19cd0b28851a2e8e88814523f240c4101152b5f 100644 (file)
@@ -29,6 +29,8 @@
 #include "VISU_ScalarMapPL.hxx"
 #include "VISU_PipeLineUtils.hxx"
 
+static int MYVTKDEBUG = 0;
+
 #ifdef _DEBUG_
 static int MYDEBUG = 1;
 #else
@@ -40,8 +42,6 @@ vtkStandardNewMacro(VISU_ScalarMapPL);
 
 VISU_ScalarMapPL::VISU_ScalarMapPL(){
   myFieldTransform = VISU_FieldTransform::New();
-  //myFieldTransform->DebugOn();
-
   myMapperTable = VISU_LookupTable::New();
   myMapperTable->SetScale(VTK_SCALE_LINEAR);
   myMapperTable->SetHueRange(0.667,0.0);
@@ -51,16 +51,20 @@ VISU_ScalarMapPL::VISU_ScalarMapPL(){
   myBarTable->SetHueRange(0.667,0.0);
 
   myExtractor = VISU_Extractor::New();
-  //myExtractor->DebugOn();
 }
 
 
 VISU_ScalarMapPL::~VISU_ScalarMapPL(){
-  myFieldTransform->UnRegisterAllOutputs();
+  if(MYVTKDEBUG){
+    MESSAGE("VISU_ScalarMapPL::~VISU_ScalarMapPL()");
+    myFieldTransform->DebugOn();
+    myMapperTable->DebugOn();
+    myBarTable->DebugOn();
+    myExtractor->DebugOn();
+  }
   myFieldTransform->Delete();
-  myMapperTable->Delete();;
+  myMapperTable->Delete();
   myBarTable->Delete();
-  myExtractor->UnRegisterAllOutputs();
   myExtractor->Delete();
 }
 
@@ -72,6 +76,7 @@ void VISU_ScalarMapPL::ShallowCopy(VISU_PipeLine *thePipeLine){
     SetScalarMode(aPipeLine->GetScalarMode());
     SetNbColors(aPipeLine->GetNbColors());
     SetScaling(aPipeLine->GetScaling());
+    
     //Update();
   }
 }
index 6c52da23b33269b32e4d29fe4116231572fd4952..6c01fac7f214de8fa20de6a5dca5e275854c4ff8 100644 (file)
@@ -73,5 +73,6 @@ void VISU_UsedPointsFilter::Execute(){
   }
   anOutput->SetPoints(aNewPoints);
   aNewPoints->Delete();
+  anIdList->Delete();
   aPoints->Delete();
 }
index d4e1ee61553726f19241a932ee11cc96c2b91ee4..2d3e1cebd309507f1cab2e19daa28718b2419915 100644 (file)
@@ -132,7 +132,7 @@ VISU::Result_i::Result_i(SALOMEDS::Study_ptr theStudy, const TSourceId& aSourceI
   myInput = NULL;
   myIsDone = 0;
   CORBA::String_var aName = theStudy->Name();
-  MESSAGE("Result_i::Result_i - this = "<<this<<"; StudyId = "<<
+  if(MYDEBUG) MESSAGE("Result_i::Result_i - this = "<<this<<"; StudyId = "<<
        theStudy->StudyId()<<"; Name = '"<<aName.in()<<"'");
 }
 
@@ -146,7 +146,7 @@ int VISU::Result_i::IsPossible(){
   try{
     float aSize = myInput->GetSize();
     bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
-    MESSAGE("Result_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<float(aResult));
+    if(MYDEBUG) MESSAGE("Result_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<float(aResult));
     return aResult;
   }catch(std::exception& exc){
     INFOS("Follow exception was occured :\n"<<exc.what());
@@ -435,7 +435,7 @@ VISU::Storable* VISU::Result_i::Create(const char* theFileName){
       static QString aCommand;
       aCommand.sprintf("cp %s %s",myFileInfo.absFilePath().latin1(),aTmpDir.get());
       if(system(aCommand) == -1){
-       MESSAGE("Create - Can't execute the command :"<<aCommand);
+       if(MYDEBUG) MESSAGE("Create - Can't execute the command :"<<aCommand);
        return NULL;
       }
       if(MYDEBUG) MESSAGE("Result_i::Create - aCommand = "<<aCommand);
@@ -625,13 +625,13 @@ std::string VISU::Result_i::GetEntry(const std::string& theComment)
 }
 
 VISU::Result_i::~Result_i() {
-  MESSAGE("Result_i::~Result_i() - this = "<<this);
+  if(MYDEBUG) MESSAGE("Result_i::~Result_i() - this = "<<this);
   if(GetSourceId() == eRestoredFile){ 
     static QString aCommand;
     aCommand.sprintf("rm %s",myFileInfo.filePath().latin1());
-    MESSAGE("Result_i::~Result_i - system("<<aCommand<<") = "<<system(aCommand));
+    if(MYDEBUG) MESSAGE("Result_i::~Result_i - system("<<aCommand<<") = "<<system(aCommand));
     aCommand.sprintf("rmdir --ignore-fail-on-non-empty %s",myFileInfo.dirPath().latin1());
-    MESSAGE("Result_i::~Result_i - system("<<aCommand<<") = "<<system(aCommand));
+    if(MYDEBUG) MESSAGE("Result_i::~Result_i - system("<<aCommand<<") = "<<system(aCommand));
   }
   if(myInput) delete myInput;
 }
index 2fbf7b591da9fcca3b1e34ec07096530b58af40c..0f97e2d6c9a8e07830df29f506019439a12021ba 100644 (file)
@@ -53,7 +53,7 @@ int VISU::ScalarMap_i::IsPossible(Result_i* theResult, const char* theMeshName,
     bool aResult = true;
     if(isMemoryCheck){
       aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
-      MESSAGE("ScalarMap_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+      if (MYDEBUG) MESSAGE("ScalarMap_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
     }
     return aResult;
   }catch(std::exception& exc){