Basically, you need to add the /DELAYLOAD linker flag for all the vtk dlls that your program depends on directly.<br><br>This is done for you automatically in the CVS HEAD version of VTK.<br><br>You can follow the directions here...:<br>
<a href="http://vtk.org/get-software.php#cvs">http://vtk.org/get-software.php#cvs</a><br>...to download the VTK source code from CVS.<br><br>That's the easiest way to get a shared library build where the false mem leaks are not reported.<br>
<br>But if you want, you can try adding the necessary DELAYLOAD linker flags to your VTK 5.0 build.<br><br>(1) When you run CMake to configure VTK, show the advanced settings and add the flags to the CMAKE_EXE_LINKER_FLAGS advanced variable. Something like the following appended to the end of CMAKE_EXE_LINKER_FLAGS:<br>
/DELAYLOAD:vtkRendering.dll /DELAYLOAD:vtkIO.dll /DELAYLOAD:vtkFiltering.dll /DELAYLOAD:vtkCommon.dll<br><br>You may have to add more of the vtk dlls if your executable depends on more vtk dlls directly.<br>
<br>(2) Using the /DELAYLOAD flag also implies that you will need to link to the "DelayImp" library.<br>TARGET_LINK_LIBRARIES(yourExe DelayImp)<br><br><br>HTH,<br>David<br><br><br><div><span class="gmail_quote">On 3/6/08, <b class="gmail_sendername">David Cole</b> <<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Please mail your replies to the VTK mailing list as well... Perhaps somebody else will benefit from this information or be able to answer your question more clearly...<div><span class="e" id="q_11883e8ce2feb1ac_1"><br><br>
<br><div><span class="gmail_quote">On 3/6/08, <b class="gmail_sendername">Hochan Kim</b> <<a href="mailto:hckim@andong.ac.kr" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">hckim@andong.ac.kr</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="KO">
<div>
<p><span lang="EN-US">I built the VTK/Examples/GUI/Win32/vtkMFC/vtkSDI.
And the VTK version is 5.0.3. </span></p>
<p><span lang="EN-US">Before receiving your reply, I changed the vtk
installation to static library from shared one by OFF the BUILD_SHARED_LIBS at cmake.
And it does not make memory leaks.</span></p>
<p><span lang="EN-US">So the problem is strongly concerned with DLL
as you mentioned. But I don't know how to fixing the CVS HEAD. Actually I
didn't have any experience with CVS. Can I fix the problem with changing
project setting within the Visual C++? </span></p>
<p><span lang="EN-US">Thank you.</span></p>
<p><span lang="EN-US">Hochan</span></p>
<p><span style="font-size: 10pt; color: rgb(31, 73, 125);" lang="EN-US"> </span></p>
<p style="text-align: justify;"><span style="font-size: 10pt; color: rgb(31, 73, 125);" lang="EN-US">---------------------------------------------------------------------------------------</span></p>
<p style="text-align: justify;"><span style="font-size: 10pt; color: rgb(31, 73, 125);" lang="EN-US"> Hochan
Kim Ph. D. </span></p>
<p style="text-align: justify;"><span style="font-size: 10pt; color: rgb(31, 73, 125);" lang="EN-US"> ssistant
professor,
<a href="mailto:hckim@andong.ac.kr" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">hckim@andong.ac.kr</a>
</span></p>
<p style="text-align: justify;"><span style="font-size: 10pt; color: rgb(31, 73, 125);" lang="EN-US"> School of
Mechanical Engineering, Andong National University</span></p>
<p style="text-align: justify;"><span style="font-size: 10pt; color: rgb(31, 73, 125);" lang="EN-US"> 388
Song-chon Dong, Andong, Kyoung-buk, 760-749, South Korea</span></p>
<p style="text-align: justify;"><span style="font-size: 10pt; color: rgb(31, 73, 125);" lang="EN-US"> Tel:
+82-54-820-5269
Fax: +82-54-820-5044</span></p>
<p style="text-align: justify;"><span style="font-size: 10pt; color: rgb(31, 73, 125);" lang="EN-US">---------------------------------------------------------------------------------------</span></p>
<p><span style="font-size: 10pt; color: rgb(31, 73, 125);" lang="EN-US"> </span></p>
<div style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0cm 0cm;">
<p><b><span style="font-size: 10pt;" lang="EN-US">From:</span></b><span style="font-size: 10pt;" lang="EN-US"> David Cole [mailto:<a href="mailto:david.cole@kitware.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">david.cole@kitware.com</a>] <br>
<b>Sent:</b> Tuesday, March 04, 2008 10:08 PM<br>
<b>To:</b> Hochan Kim<br>
<b>Cc:</b> <a href="mailto:vtkusers@vtk.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">vtkusers@vtk.org</a><br>
<b>Subject:</b> Re: [vtkusers] vtkMFC memory leaking</span></p>
</div><div><span>
<p><span lang="EN-US"> </span></p>
<p style="margin-bottom: 12pt;"><span lang="EN-US">Which
executable did you build?<br>
<br>
VTK/Examples/GUI/Win32/vtkMFC/vtkMDI or something else?<br>
<br>
What version of VTK are you using? The MFC mem leak problem is usually a
"false alarm" in VTK-5-0 caused by the ordering of loading of VTK
dlls. It should be fixed in the CVS HEAD build of VTK because we added code to
delay load the VTK dlls, thereby ensuring that they are unloaded *before* the
MFC dlls and then the MFC dlls can do their mem leak analysis correctly.<br>
<br>
<br>
HTH,<br>
David<br>
<br>
<br>
<br>
</span></p>
<div>
<p><span><span lang="EN-US">On 3/4/08, <b>Hochan
Kim</b> <<a href="mailto:hckim@andong.ac.kr" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">hckim@andong.ac.kr</a>>
wrote:</span></span><span lang="EN-US"></span></p>
<div>
<div>
<p><span lang="EN-US">Hi. Everybody!</span></p>
<p><span lang="EN-US">I build the example project vtkMFC, but when executed with
debug mode it generates a lot of memory leak.</span></p>
<p><span lang="EN-US">I'm using VS2005 with winXP. If you know anything about the
problem please tell me whatever.</span></p>
<p><span lang="EN-US">Thanks!</span></p>
</div>
</div>
<p style="margin-bottom: 12pt;"><span lang="EN-US"><br>
_______________________________________________<br>
This is the private VTK discussion list.<br>
Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/mailman/listinfo/vtkusers</a></span></p>
</div>
<p><span lang="EN-US"> </span></p>
</span></div></div>
</div>
</blockquote></div><br>
</span></div></blockquote></div><br>