[vtkusers] Reference counting in 6.3

Weiguang guan guanw at rhpcs.mcmaster.ca
Thu Oct 15 16:13:17 EDT 2015


Hello,

I find, in debug mode, that the ReferenceCount of 
a vtkImageEllipsoidSource object becomes 2 right after being initiated 
(vtkImageEllipsoidSourc::New()). It should be 1 not 2, right? How could 
this happen?

My second question is --- when you make a connection 
A->SetInputConnection(B->GetOutputPort()); Whose reference count will be 
increased by 1, A or B? I think B's reference count should be increased 
because it is used by A. But what I find is just the opposite.

My third question is about setting up more than 1 connection for a 
filter. Taking vtkImageMathematics as an example, I do
vtkImageMathematics* A = vtkImageMathematics::New();
A->SetInputConnection(0, B1->GetOutputPort();
A->SetInputConnection(0, B2->GetOutputPort();

I find that the reference count of A gets increased by the first 
SetInputConnection() call only.

Can someone explain how reference counting works in VTK? Thanks.

Best,
Weiguang


More information about the vtkusers mailing list