[vtkusers] unfreed memory?

Luca Picello luca.picello at libero.it
Thu Sep 15 12:23:05 EDT 2005


You're absolutely right!!!
in this example I forgot to call

sphere0->Delete();  // delete source if we no longer need it
and
sphereMapper0->Delete(); //delete mapper since actor has referenced it  

And now it seems the memory is right deallocated.
Sorry for the mistake...

Luca





dean.inglis at camris.ca wrote:

>Luca
>
>have you tried this....
>
>//---------------------------------------------------------------------------
>void __fastcall TForm1::testClick(TObject *Sender)
>{
>
>  Label1->Caption = count++;
>
>  for(double d=0; d<100; d+=1 )
>  {
>    vtkSphereSource* sphere0 = vtkSphereSource::New();
>    sphere0->SetRadius( 25 );
>    sphere0->SetCenter( d,d*d,0 ); // all the times I add spheres at same position. but, who cares??
>
>    sphere0->Update(); // force source to generate output, don't wait for rendering pipeline
>
>    vtkPolyDataMapper* sphereMapper0 = vtkPolyDataMapper::New();
>    sphereMapper0->SetInput(sphere0->GetOutput());
>
>    sphere0->Delete();  // delete source if we no longer need it
>
>    vtkActor* sphereActor0 = vtkActor::New();
>    sphereActor0->SetMapper(sphereMapper0);
>
>    sphereMapper0->Delete(); //delete mapper since actor has referenced it  
>
>    (sphereActor0->GetProperty())->SetColor( 0, 0, 0 );
>    vtkBorlandRenderWindow1->GetRenderer()->AddActor( sphereActor0 );
>
>    actorcoll.push_back( sphereActor0 );
>  }
>
>  vtkBorlandRenderWindow1->GetRenderer()->ResetCameraClippingRange();
>  vtkBorlandRenderWindow1->GetRenderer()->ResetCamera();
>  vtkBorlandRenderWindow1->Invalidate();
>}
>
>
>Dean
>
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers
>.
>
>  
>




More information about the vtkusers mailing list