[vtkusers] Reference counting not work !!!

Will Schroeder will.schroeder at kitware.com
Tue Feb 6 17:41:16 EST 2001

Hi Walter-

At 04:37 PM 2/6/2001 -0200, Walter Herrera wrote:

>vtkConeSource cone
>   cone SetResolution 8
>vtkPolyDataMapper coneMapper
>   coneMapper SetInput [cone GetOutput]
>vtkActor coneActor
>   coneActor SetMapper coneMapper
>cone Delete
>[coneMapper GetInput] GetReferenceCount
>and I do not understand why the result of the last command is 2...
>wouldn't the result must be 1?

The output of vtkConeSOurce (a vtkPolyData) refers to its generating 
process object (the vtkDataObject::SetSource() method). So when the object 
is created, its reference count is 1, then the data object registers it so 
the count goes to 2, and then the coneMapper SetInput() brings it to 3. 
Your delete brings it back down to 2.

Be careful playing around with Deletes and such...


William J. Schroeder, Ph.D
Kitware, Inc.
469 Clifton Corporate Parkway
Clifton Park, NY 12065
will.schroeder at kitware.com
1-518-371-3971 x102
1-518-371-3971 (fax)

More information about the vtkusers mailing list