[vtkusers] Delete vtkObjects

David Cole david.cole at kitware.com
Thu Aug 14 12:55:50 EDT 2008


You must be creating some other vtkObjects from somewhere else in your code
that are not being cleaned up.
Can you set a breakpoint in the vtkObject::vtkObject constructor and see
where you are creating them from? You should only hit that breakpoint from
your Init_3D method if that is the only place where you are creating them
from...


On Thu, Aug 14, 2008 at 11:53 AM, Andi2008 <mail-andi at web.de> wrote:

>
> No, the DebugLeakReport appears when i close the application. Therefore i
> just include the vtkDebugLeaks.h
>
> the method that instantiates and delete the surrounding class is called
> from
> from a combobox and the whole method is:
>
> void ImageCtrl::Init_3D(void)
> {
>        ImageVolumeData *vtkModul = new ImageVolumeData();
>
>        delete vtkModul;
>
>        return;
> }
>
> The class ImageCtrl is derived from CCmdTarget and handles the
> Messagerouting in the program.
>
> I debugged thought the code and watched the ProcessExplorers
> PrivateByteHistory of the running programm. I did the same in the
> vtkexamples and there everything works fine. I know it sounds strange and
> obviously it is a mistake on my side.
>
> Does anybody has an idea
> Andi
>
>
>
>
>
>
> David Cole wrote:
> >
> > Where is your code that instantiates/deletes the surrounding C++ class?
> > Are you saying that instantiating one of those and then deleting it
> > results
> > in a VTK mem leak report?
> >
> >
> > On Thu, Aug 14, 2008 at 10:48 AM, Andi2008 <mail-andi at web.de> wrote:
> >
> >>
> >> thank you for the quick answer.But my case is different. I fixed the
> >> leaks
> >> he
> >> reported already by loading all vtl dlls delayed. I am using MFC too.
> >> Visual
> >> Studio report leaks only if i create vtkObjects.vtkDebugLeaks and the
> >> fact
> >> that the private byte history in the ProcessExplorer doesnt decrease
> >> after
> >> i
> >> the objects tells me that the leaks come from vtk.
> >>
> >> I have no idea anymore what iam doing wrong.
> >> Andi
> >>
> >>
> >>
> >> malat wrote:
> >> >
> >> > 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
> >> > _______________________________________________
> >> > 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
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Delete-vtkObjects-tp18980765p18983087.html
> >> Sent from the VTK - Users mailing list archive at Nabble.com.
> >>
> >> _______________________________________________
> >> 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
> >>
> >
> > _______________________________________________
> > 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
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Delete-vtkObjects-tp18980765p18984404.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080814/a94b32d0/attachment.htm>


More information about the vtkusers mailing list