It&#39;s because you are calling<br>&nbsp;
this-&gt;SetNumberOfInputPorts(0);<br>in your constructor. Your parent class sets it to 1.<br><br>When you call this, you get connected to the default executive that&#39;s created by the parent class and form a &quot;reference loop&quot;. This is ok and expected, though.<br>
<br>If you call:<br>&nbsp; vtkH5PolyDataReader* reader = vtkH5PolyDataReader::New();<br>&nbsp; reader-&gt;Print(cout);<br>&nbsp; reader-&gt;Delete();<br>your reader will be deleted even though in the middle it has a ref count of 2... Set breakpoints (or put &quot;cout &lt;&lt;&quot; stuff) in the constructor / destructor for this simple case to prove it to yourself.<br>
<br><br>HTH,<br>David<br><br><br><div class="gmail_quote">On Mon, Apr 28, 2008 at 6:09 PM, Mike Jackson &lt;<a href="mailto:imikejackson@gmail.com">imikejackson@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I have a class that I am writing that inherits from<br>
vtkPolyDataAlgorithm. After calling:<br>
<br>
vtkH5PolyDataReader* reader = vtkH5PolyDataReader::New();<br>
the reference count is 2. Shouldn&#39;t it be 1? I have another generic<br>
class the inherits from vtkObject and running the same basic test<br>
gives me a reference count of 1. What might be some reasons why my ref<br>
count is 2? I think this is causing other problems in my code.<br>
<br>
Here is my constructor:<br>
<br>
vtkCxxRevisionMacro(vtkH5PolyDataReader, &quot;1.0&quot;);<br>
vtkStandardNewMacro(vtkH5PolyDataReader);<br>
<br>
vtkH5PolyDataReader::vtkH5PolyDataReader()<br>
{<br>
&nbsp;this-&gt;FileName = NULL;<br>
&nbsp;this-&gt;SetNumberOfInputPorts(0);<br>
}<br>
<br>
I also have the following in the header:<br>
<br>
public:<br>
static vtkH5PolyDataReader *New();<br>
<br>
protected:<br>
 &nbsp;vtkH5PolyDataReader();<br>
&nbsp;~ vtkH5PolyDataReader();<br>
<br>
<br>
Thanks for any help on this.<br>
<font color="#888888">--<br>
Mike Jackson<br>
imikejackson _at_ gee-mail dot com<br>
_______________________________________________<br>
This is the private VTK discussion list.<br>
Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</font></blockquote></div><br>