[vtkusers] VTK not releasing memory, including minimal example.
P.J.Schaafsma
jetze.schaafsma at gmail.com
Sun Sep 23 14:05:39 EDT 2012
...and the VTK_DEBUG_LEAKS output. Seems to work. Everything is cleaned up.
Still, memory use is > 100Mb during the event loop in this simple case.
Used source:
int main()
{
vtkXMLImageDataReader *reader = vtkXMLImageDataReader::New();
//reader->SetFileName("e:\\data\\volume\\manix_low.vti");
reader->SetFileName("/media/Data/data/volume/manix_low.vti");
vtkContourFilter *contour = vtkContourFilter::New();
contour->SetInputConnection(reader->GetOutputPort());
contour->SetValue(0, 800);
vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
mapper->SetInputConnection(contour->GetOutputPort());
mapper->Update();
vtkActor *actor = vtkActor::New();
actor->SetMapper(mapper);
vtkRenderer *renderer = vtkRenderer::New();
renderer->AddActor(actor);
vtkRenderWindow *render_window = vtkRenderWindow::New();
render_window->AddRenderer(renderer);
vtkInteractorStyleTrackballCamera *style =
vtkInteractorStyleTrackballCamera::New();
vtkRenderWindowInteractor *interactor = vtkRenderWindowInteractor::New();
interactor->SetInteractorStyle(style);
interactor->SetRenderWindow(render_window);
interactor->Initialize();
////// Comment this out and save memory
render_window->Render();
//////
renderer->RemoveActor(actor);
render_window->Render();
actor->Delete();
mapper->Delete();
contour->Delete();
reader->Delete();
interactor->Start();
render_window->RemoveRenderer(renderer);
interactor->SetInteractorStyle(0);
style->Delete();
interactor->Delete();
renderer->Delete();
render_window->Delete();
// Just checking debug leaks works
vtkActor *a = vtkActor::New();
return 0;
}
Output
vtkDebugLeaks has detected LEAKS!
Class "vtkMatrix4x4" has 2 instances still around.
Class "vtkOpenGLActor" has 1 instance still around.
Class "vtkTransform" has 1 instance still around.
--
View this message in context: http://vtk.1045678.n5.nabble.com/VTK-not-releasing-memory-including-minimal-example-tp5716258p5716262.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list