Subject: Re: [vtkusers] memory leaks in a c++ programm with vtk

Peter F Bradshaw pfb at exadios.com
Sun Jul 2 02:34:23 EDT 2006


Hi Justus;

On Fri, 30 Jun 2006, Justus Kreuels wrote:

>
> Hi Peter.
>
> I get a popup with the following Text in it, if i delete one of the vtk-
> member-pointers
> in a subclass of my programm with for exampel m_vtkSrc->Delete(); :
>
> "Windows has triggered a breakpoint in Osteomorph.exe.

Presumably Osteomorph is tha name of the program you are developing and
the breakpoint is the equivalent of a segment violation or buss error.

>
> This may be due to a corruption of the heap, and indicates a bug in
> Osteomorph.exe or any of the DLLs it has loaded.

The most common cause of problems when calling vtk*::Delete() are caused
by deleting the same object more than once. That is, the pointer to the
object is stale. This is why it is important to try and isolate the
actual m_*->Delete() that is causing your problem. Once you have done
that then you can enable the debug output for that object (m_*->DebugOn)
and save the output to a file. Then examine the file for an early delete.
You may have to get you debugger involved as well.

If the problem is caused by heap or stack corruption then you must
locate the code that is overwriting the memory.

>
> The output window may have more diagnostic information"
>
> Perhaps you have an idea?
>
> Best regards
> Justus
>
>
> >Message: 12
> >Date: Wed, 28 Jun 2006 08:29:07 +0800 (WST)
> >From: Peter F Bradshaw <pfb at exadios.com>
> >Subject: Re: [vtkusers] memory leaks in a c++ programm with vtk
> >To: vtkusers at vtk.org
> >Message-ID: <Pine.LNX.4.58.0606280827110.1866 at goldmund.pri>
> >Content-Type: TEXT/PLAIN; charset=US-ASCII
> >
> >Hi Justus;
> >
> >On Tue, 27 Jun 2006, Justus Kreuels wrote:
> >
> >> Hello.
> >>
> >> When I Create vtk-Objects as Membervariables of a c++ class, i get an
> >> error when i delete these objects in the destructur of the class.
> >
> >What is the error you get?
> >
> >Does this happen with all your vtk member variables or just one or two?
> >
> >>
> >> When I don't delete the objects my programm has memory leaks.
> >>
> >> When I greate a vtk-Object only local in a function, it's no problem
> to
> >> use the delete-Method of the Object.
> >>
> >> What could be the reason for this behaviour. I use VS 2005 and
> Windows
> >> XP. With VS 7.0 I had the same problem.
> >>
> >> Thank you very Much
> >> Justus Kreuels
> >
> >Cheers
>
>

Cheers

-- 
Peter F Bradshaw, http://www.exadios.com
Public key at www.exadios.com/pfb.pgp.key and www.exadios.com/pfb.gpg.key
Personal site: http://personal.exadios.com
"I love truth, and the way the government still uses it occasionally to
 keep us guessing." - Sam Kekovich.



More information about the vtkusers mailing list