[vtkusers] unfreed memory?

dean.inglis at camris.ca dean.inglis at camris.ca
Thu Sep 15 05:14:18 EDT 2005


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




More information about the vtkusers mailing list