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

Andrew J. P. Maclean a.maclean at acfr.usyd.edu.au
Thu Feb 28 00:31:39 EST 2002


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/6a934986/attachment.htm>


More information about the vtkusers mailing list