[vtkusers] memory management

Berk Geveci berkgeveci at hotmail.com
Mon Sep 24 09:32:18 EDT 2001


If your VTK is recent enough, you can turn on VTK_DEBUG_LEAKS. Depending on 
which
version of VTK you are using, you might have to add -DVTK_DEBUG_LEAKS to 
your
user.make and recompile or set an entry in CMake and recompile. With 
debug_leaks
on, you will get a list of all VTK objects which leak at exit. Note that you 
will
only see the VTK objects which leak. If for some reason, you ran into 
another
ort of leak (a VTK filter which does not delete an array for example), this 
will
not be reported. If this is the case, I recommend that you get the latest
VTK before reporting a bug.
Also, which platform are you running this program on ?

-Berk

>From: "Michele Zamponi" <michele.zamponi at menci.com>
>To: <vtkusers at public.kitware.com>
>Subject: [vtkusers] memory management
>Date: Mon, 24 Sep 2001 14:59:48 +0200
>
>Hello,
>
>I have a big problem of memory managment using VTK libraries.
>
>In my window's document constructor I instantiate a set of VTK objects as 
>follows:
>
>
>   this->Reader = vtkDataSetReader::New();
>   this->Mapper = vtkPolyDataMapper::New();
>   this->Actor = vtkActor::New();
>   this->CutterMapper = vtkPolyDataMapper::New();
>   this->CutterActor = vtkActor::New();
>   this->ContourMapper = vtkPolyDataMapper::New();
>   this->ContourActor = vtkActor::New();
>   this->Smoother = vtkSmoothPolyDataFilter::New();
>   this->Decimator = vtkDecimatePro::New();
>   this->Actor->SetMapper(this->Mapper);
>   this->Actor->VisibilityOff();
>   this->CutterActor->SetMapper(this->CutterMapper);
>   this->CutterActor->VisibilityOff();
>   this->ContourActor->SetMapper(this->ContourMapper);
>   this->ContourActor->VisibilityOff();
>   this->Props->AddItem(this->Actor);
>   this->Props->AddItem(this->CutterActor);
>   this->Props->AddItem(this->ContourActor);
>   this->Points  = vtkPoints::New();
>   this->PolyData = vtkPolyData::New();
>   this->Delaunay2D =   vtkDelaunay2D::New();
>   this->TriangleFilter = vtkTriangleFilter::New();
>   this->Cutter = vtkCutter::New();
>   this->CutterPlane = vtkPlane::New();
>   this->ContourPlane = vtkPlane::New();
>   this->Contour = vtkCutter::New();
>
>
>   and in the destructor I use the following instructions:
>
>   this->TriangleFilter->Delete();
>   this->Delaunay2D->Delete();
>   this->PolyData->Delete();
>   this->Points->Delete();
>   this->Reader->Delete();
>   this->Mapper->Delete();
>   this->Actor->Delete();
>   this->CutterMapper->Delete();
>   this->CutterActor->Delete();
>   this->ContourMapper->Delete();
>   this->ContourActor->Delete();
>   this->Smoother->Delete();
>   this->Decimator->Delete();
>   this->ContourPlane->Delete();
>   this->Contour->Delete();
>   this->Cutter->Delete();
>   this->CutterPlane->Delete();
>
>
>After the class' destruction I can see that VTK libraries don't free all 
>the memory
>they allocated. Otherwise, after showing a model of about 150.000 
>triangles, I lose
>about 50-80Mb of RAM.
>So, I have only to show 2 or 3 models to reach the phisical memory limit.
>
>Where do I do the mistake?
>Thank you in advance for any help!
>
>Michele Zamponi
>michele.zamponi at menci.com
>


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp




More information about the vtkusers mailing list