[vtkusers] Delete vtkObjects

Mathieu Malaterre mathieu.malaterre at gmail.com
Thu Aug 14 09:28:08 EDT 2008


Andreas,

  I you are using MFC, I suggest to read the following post:

http://www.vtk.org/pipermail/vtkusers/2007-May/090968.html

  The non-compiling example you posted looks fine to me.

2cts
-Mathieu

On Thu, Aug 14, 2008 at 2:41 PM, Andreas Brüning <mail-andi at web.de> wrote:
> Hi,
>
> yes it is me again and i still have questions about deleting vtkobjects :)
> Regarding to my post from Aug/12:
>
> http://www.vtk.org/pipermail/vtkusers/2008-August/096455.html
>
> i still have problems to delete vtkobjects in my program and it is not only the thread issue. To encapsulate the whole vtk stuff i created it in a single class. I created some vtk objects in the constructor and call the Delete() method in the destructor for testing. Than i created one of these class and delete  it while i checked the private bytes history on Sysinternals ProcessExplorer(which is by the way a great tool). I also enabled VTK_DEGUG_LEAKS.
> I thought when i delete the class the whole vtk stuff is gone but it is not. i can see no memory reduction in the process explorer and the DebugLeaks MessageBox tells me that always the objects remains. When i create a vtkPolyDataMapper there are even more. If i create more of my vtkClasses there are no changes in the memory but the debugleaks MessageBox report that all the vtkObjects remain in memory.
>
> I really have no idea where is the mistake. I did the same procedure with the vtkExamples and there everything is fine and the memory always cleans up. I compared the project properies and they are the same.
>
> Here is the code of my very short vtkClass:
>
>
> #include "StdAfx.h"
>
> #include "ImageVolumeData.h"
>
> #undef THIS_FILE
> static char BASED_CODE THIS_FILE[]=__FILE__;
>
> #define new DEBUG_NEW
>
>
> ImageVolumeData::ImageVolumeData(void)
> {
>        vtk_importer = vtkImageImport::New();  //global Variables defined in the header
>        vtkflipper = vtkImageFlip::New();
>
>        //debugger = vtkDebugLeaks::New();
>        ren = vtkRenderer::New();
>
> }
>
> ImageVolumeData::~ImageVolumeData(void)
> {
>        vtk_importer->SetImportVoidPointer(NULL,0);
>
>        vtkflipper->Delete();
>        vtk_importer->Delete();
>
>        ren->Delete();
>
> }
>
> I hope someone can give me an advice, i am running out of ideas
>
> Thanks in advance
> Andi
> _____________________________________________________________________
> Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
> http://smartsurfer.web.de/?mc=100071&distributionid=000000000066
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



-- 
Mathieu



More information about the vtkusers mailing list