[vtkusers] Memory Leaks under VC++ 6.0/MFC.

William A. Hoffman billlist at nycap.rr.com
Thu Feb 28 07:25:32 EST 2002


VTK libraries can be either DLL's or static libraries on windows. 
However, I don't see what that has to do with which MFC library you
should be using.   It sounds like the memory leak is in MFC and
has nothing to do with VTK.   If you made a test case without VTK but
used the MFC dll would it still leak?  (I would make sure the test case
used OpenGL, if it did not leak without it)

-Bill


At 04:31 PM 2/28/2002 +1100, Andrew J. P. Maclean wrote:

>When building MFC applications I have been getting memory leaks when the program exits. 
>
> 
>
>The cause of these memory leaks relates to using the MFC library as a shared DLL. So to avoid memory leaks you must use the MFC library as a statically linked library. However, the MCF App Wizard, by default, selects using the library as a shared DLL, so when creating a project make sure to click on the As a statically linked library radio button in the IDE. When building an SDI or a MDI application this is Step 5 in the MFC App Wizard and for a Dialog application, this is Step 3.
>
> 
>
>Since the vtk libraries and DLLs are built as static libraries so we should be using the MFC library as a statically linked library!
>
> 
>
>I hope this helps those who have noticed the leaks in the past.
>
>Perhaps this could become a FAQ entry.
>
> 
>
>Sometime in the near future, I promise that I will amend the samples that I created recently so that the MFC library is linked in as a statically linked library. 
>
> 
>
>Andrew
>
> 
>
>
>___________________________________________
>Andrew J. P. Maclean
>
>
>
>Postal:
>
>Australian Centre for Field Robotics
>The Rose Street Building J04
>The University of Sydney  2006  NSW
>AUSTRALIA
>
>Room:
>
>106
>
>Phone:
>
>+61 2 9351 3283
>
>Fax:
>
>+61 2 9351 7474
>
> 
>
><http://www.acfr.usyd.edu.au/>http://www.acfr.usyd.edu.au/
>
>___________________________________________
>
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20020228/3797b5ed/attachment.htm>


More information about the vtkusers mailing list