From: enk Date: Tue, 22 Mar 2005 12:19:16 +0000 (+0000) Subject: VISU memory management debugging X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FRTV_debug_01;p=modules%2Fvisu.git VISU memory management debugging --- diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index 5fcb2f9e..7e8ca43c 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -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="<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="<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="<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="<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="<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="<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() = "<GetCellLinks()->GetActualMemorySize()*1000)); MSG(MYVTKDEBUG,"GetMeshOnEntity - GetActualMemorySize() = "<GetActualMemorySize()*1000)); } + }catch(std::exception& exc){ + MSG(1,"Follow exception was occured :\n"< TPointsDim; TPointsDim myPointsDim; + ~TMeshImpl(); }; typedef shared_ptr PMeshImpl; @@ -53,6 +54,7 @@ namespace VISU{ typedef std::vector TConnForCellType; typedef std::map TCellsConn; TCellsConn myCellsConn; + ~TMeshOnEntityImpl(); }; typedef shared_ptr PMeshOnEntityImpl; @@ -62,21 +64,20 @@ namespace VISU{ typedef std::set TSubMeshOnCellType; typedef std::map TSubMesh; TSubMesh mySubMesh; + ~TFamilyImpl(); }; typedef shared_ptr PFamilyImpl; struct TGroupImpl: TGroup{ TVTKSource myStorage; + ~TGroupImpl(); }; typedef shared_ptr PGroupImpl; struct TFieldImpl: TField{ TVTKExtractFilter myExtractFilter; - ~TFieldImpl() - { - if(myExtractFilter.GetPointer()) - myExtractFilter->UnRegisterAllOutputs(); - } + ~TFieldImpl(); + }; typedef shared_ptr PFieldImpl; @@ -89,13 +90,7 @@ namespace VISU{ typedef std::map TValForCells; TValForCells myValForCells; - ~TValForTimeImpl() - { - if(myMergeFilter.GetPointer()) - myMergeFilter->UnRegisterAllOutputs(); - if(myAttribyteFilter.GetPointer()) - myAttribyteFilter->UnRegisterAllOutputs(); - } + ~TValForTimeImpl(); }; typedef shared_ptr PValForTimeImpl; diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index d26af3b9..506e0ee0 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -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(); } diff --git a/src/OBJECT/VISU_MeshAct.cxx b/src/OBJECT/VISU_MeshAct.cxx index ac262e52..2d8b6367 100644 --- a/src/OBJECT/VISU_MeshAct.cxx +++ b/src/OBJECT/VISU_MeshAct.cxx @@ -39,6 +39,8 @@ #include #include +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(); diff --git a/src/OBJECT/VISU_MeshAct.h b/src/OBJECT/VISU_MeshAct.h index 6530c7a2..f1504a01 100644 --- a/src/OBJECT/VISU_MeshAct.h +++ b/src/OBJECT/VISU_MeshAct.h @@ -81,3 +81,7 @@ class VTKOCC_EXPORT VISU_MeshAct : public VISU_Actor { }; #endif + +#ifndef MESSAGE +#define MESSAGE(msg) std::cout<<__FILE__<<"["<<__LINE__<<"]::"< #include +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()"<DebugOn(); + } myScalarBar->Delete(); } diff --git a/src/PIPELINE/VISU_CutPlanesPL.cxx b/src/PIPELINE/VISU_CutPlanesPL.cxx index be8925f4..e71f2234 100644 --- a/src/PIPELINE/VISU_CutPlanesPL.cxx +++ b/src/PIPELINE/VISU_CutPlanesPL.cxx @@ -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(); } diff --git a/src/PIPELINE/VISU_DeformedShapePL.cxx b/src/PIPELINE/VISU_DeformedShapePL.cxx index 9b200331..00f51085 100644 --- a/src/PIPELINE/VISU_DeformedShapePL.cxx +++ b/src/PIPELINE/VISU_DeformedShapePL.cxx @@ -31,8 +31,10 @@ #include +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(); } diff --git a/src/PIPELINE/VISU_PipeLine.cxx b/src/PIPELINE/VISU_PipeLine.cxx index a99eba60..acc496b1 100644 --- a/src/PIPELINE/VISU_PipeLine.cxx +++ b/src/PIPELINE/VISU_PipeLine.cxx @@ -54,7 +54,10 @@ VISU_PipeLine::VISU_PipeLine(){ VISU_PipeLine::~VISU_PipeLine(){ if(MYDEBUG) MESSAGE("~VISU_PipeLine - 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); diff --git a/src/PIPELINE/VISU_ScalarMapPL.cxx b/src/PIPELINE/VISU_ScalarMapPL.cxx index d7b7b4a6..d19cd0b2 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.cxx +++ b/src/PIPELINE/VISU_ScalarMapPL.cxx @@ -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(); } } diff --git a/src/PIPELINE/VISU_UsedPointsFilter.cxx b/src/PIPELINE/VISU_UsedPointsFilter.cxx index 6c52da23..6c01fac7 100644 --- a/src/PIPELINE/VISU_UsedPointsFilter.cxx +++ b/src/PIPELINE/VISU_UsedPointsFilter.cxx @@ -73,5 +73,6 @@ void VISU_UsedPointsFilter::Execute(){ } anOutput->SetPoints(aNewPoints); aNewPoints->Delete(); + anIdList->Delete(); aPoints->Delete(); } diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index d4e1ee61..2d3e1ceb 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -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 = "<GetSize(); bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize); - MESSAGE("Result_i::IsPossible - CheckAvailableMemory = "<