[vtkusers] Smartpointer symatecs Question.

Mike Jackson imikejackson at gmail.com
Thu May 11 11:29:58 EDT 2006


We were working on a pipeline and had a pretty significant memory  
leak. We tracked it down to the following line of code.

  vtkSmartPointer < vtkPolyDataNormals > calcNormals  
( vtkPolyDataNormals::New() );

I noticed from another post/answer to one of my questions that a  
similar line of code was written as follows:

  vtkSmartPointer <vtkPolyDataNormals> calcNormals = vtkSmartPointer  
<vtkPolyDataNormals>::New();

I am too new to C++ to understand the subtle difference between the  
two lines of code. Others with more C++ experience tell me that there  
should be no difference. Yet using the second line of code will stop  
the memory leak.

This was using the VTK 5.1 stable from the web site and running OSX  
10.4.6 Intel/PPC.

Thanks for any help/explanation/understanding.
--------
Mike Jackson
imikejackson <at> gmail <dot> com






More information about the vtkusers mailing list