[vtkusers] VTK Destructors

Bikash Kanungo bikash at umich.edu
Thu Jul 23 09:00:48 EDT 2015


Thanks Cory. That helped.


Regards,
Bikash

On Thu, Jul 23, 2015 at 8:48 AM, Cory Quammen <cory.quammen at kitware.com>
wrote:

> Bikash,
>
> 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
>
> object->Delete();
>
> 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() );
> source->Delete();
>
> HTH,
> Cory
>
> 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.
>



-- 
Bikash S. Kanungo
PhD Student
Computational Materials Physics Group
Mechanical Engineering
University of Michigan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150723/9509e756/attachment.html>


More information about the vtkusers mailing list