[vtkusers] memory management

Michele Zamponi michele.zamponi at menci.com
Mon Oct 8 02:59:14 EDT 2001


----- Original Message ----- 
From: Michele Zamponi 
To: vtkusers at public.kitware.com 
Sent: Monday, September 24, 2001 2:59 PM
Subject: memory management


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20011008/cd50164f/attachment.htm>


More information about the vtkusers mailing list