[vtkusers] Delete() usage

Jean-Hugues Royer jhroyer at joher.com
Wed Oct 10 15:26:48 EDT 2012


Hi,

In fact I'm using C# (Activiz) and I call Dispose() instead of Delete().

My guess was that Dispose() was calling Delete() internally and that's 
why I tried to ask a generic question.

Unfortunately using VTK_DEBUG_LEAKS is not possible with C# (AFAIK ?) so 
I need to understand exactly how the memory management works to ensure 
no memory leak is present.

Your answer raise another question, I wonder how the C++ (not .NET) 
garbage collector is initialized by Activiz, any one knows ?

Regards.

On 10/10/2012 17:39, Sebastien Jourdain wrote:
> Are you in C++ or in Java. Looking at the code, it looks like Java.
>
> If you are in Java, you are almost fine, you just need to call or
> setup the specific VTK Garbage collector. No need to call Delete()
> manually.
>
> For more details, you can look at the Java sample code, which
> illustrate how to initialize it to make it run in the background,
> otherwise you can manually call it from your code.
>
> By default, it is not started and therefore, the memory is never released.
>
> Seb
>
> On Wed, Oct 10, 2012 at 10:55 AM, Jean-Hugues Royer<jhroyer at joher.com>  wrote:
>> Hi,
>>
>> Tracking memory leaks...
>>
>> As far as I read we are supposed to call the Delete() method each time we
>> issue a New() object.
>>
>>
>> Are we also supposed to call Delete() on objects we received from Get*()
>> functions ?
>>
>> Example:
>>
>> vtkPolyData pd =
>> vtkContourWidget.GetContourRepresentation().GetContourRepresentationAsPolyData()
>>
>> Do I have to call pd.Delete() to free it or will vtkContourWidget free it
>> when deleted ?
>>
>>
>> And regarding Set*() functions, example:
>>
>> vtkPlaneCollection pc = vtkPlaneCollection.New();
>> vtkSmartVolumeMapper.SetClippingPlanes(pc);
>>
>> Do I have to call pd.Delete() to free the plane collection or will it be
>> freed when the vtkSmartVolumeMapper will be deleted ?
>>
>>
>> Thanks.
>>
>> _______________________________________________
>> 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
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list