[vtkusers] VTK Destructors

Cory Quammen cory.quammen at kitware.com
Thu Jul 23 08:48:42 EDT 2015


VTK objects are managed by a garbage collector which does all the deleting
for you. To let VTK know you are done with an object, you can call


If this is the last reference to the object, the garbage collector will
delete it for you. If, however, a reference to the object is held by some
other object, it will not be garbage collected. That's why code like the
following is safe:

vtkSphereSource* source = vtkSphereSource::New()
otherFilter->SetInputConnection( source->GetOutputPort() );


On Thu, Jul 23, 2015 at 8:44 AM, Bikash Kanungo <bikash at umich.edu> wrote:

> Hi,
> I'm creating vtkHexahedron(s) using the New() public member function. The
> resultant object is pointed by a base vtkCell  pointer. Since the
> destructors of both vtkHexahedron and vtkCell are protected member
> functions, is there a way to de-allocate the memory occupied by the object
> created by New()?
> Thanks,
> Bikash
> --
> Bikash S. Kanungo
> PhD Student
> Computational Materials Physics Group
> Mechanical Engineering
> University of Michigan
> _______________________________________________
> Powered by www.kitware.com
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Search the list archives at: http://markmail.org/search/?q=vtkusers
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers

Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150723/9a2e9d80/attachment.html>

More information about the vtkusers mailing list