[vtkusers] 5.0 vtk crash with /MT build on windows

David Cole david.cole at kitware.com
Thu Nov 29 17:32:11 EST 2007


Usually this means that the "new" was performed with either (1) the
statically linked in MSVC runtime libraries or (2) the dll version of MSVCRT
and the "delete" is being performed by the other one. This sort of mismatch
will almost always eventually lead to a heap corruption.

All of your components that do cross-component new/delete operations have to
be linked to the same flavor (static or dll) or the MSVC runtime libraries.

Are you sure that *everything* is compiled with /MT??

I would try starting again with a clean binary directory to ensure that /MT
is actually used to compile *everything*. Then, also make sure there are no
other versions of VTK dll's in your PATH environment variable.

If it still happens after that, we can continue discussing other ways to
figure out why this might be happening for you..... It should work.


HTH,
David


On 11/14/07, hu ning <nickhuning at hotmail.com> wrote:
>
>  Hi,
>
> I wonder if anyone here has experienced this kind of problem and could
> give me some advice: I have to build the vtk 5.0.3 shared libraries with
> /MT instead of /MD on VC++ 8, then every time when my application start
> initializing vtkRenderWindow it crashes. I am able to find in the class
> vtkOpenGLRenderWindow:
> vtkOpenGLRenderWindow::vtkOpenGLRenderWindow()
> {
>         this->MultiSamples =
> vtkOpenGLRenderWindowGlobalMaximumNumberOfMultiSamples;
>          this->TextureResourceIds = vtkIdList::New();
>           if ( this->WindowName )
>                 delete [] this->WindowName; ########## crash here
>           this->WindowName = new char[strlen("Visualization Toolkit -
> OpenGL")+1];
>                 strcpy( this->WindowName, "Visualization Toolkit - OpenGL"
> );
> }
>
> when it try to delete [] this->WindowName, there is memory corruption. I
> checked the content in the this->WindowName and it seems correct.
>
> I also tested with the same vtk version with /MD build which is default
> setting, and it runs ok. The reason I need to have /MT because all the
> components in my app are built with /MT. The previous release of vtk, 4.2,
> doesn't have this problem.
>
> Any discussion/advice will be highly appreciated!
>
> Thank you,
>
> Nick
>
> ------------------------------
> Are you ready for Windows Live Messenger Beta 8.5 ? Get the latest for
> free today! <http://entertainment.sympatico.msn.ca/WindowsLiveMessenger>
>
> _______________________________________________
> 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/20071129/3b5aa3a7/attachment.htm>


More information about the vtkusers mailing list