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

Gopalakrishnan, Gowri Gowri.Gopalakrishnan at inteq.com
Thu Feb 28 09:02:30 EST 2002


Hi I just wanted to say a comment or two on the memory leak issue. I had
exactly the same problem ( while exiting 

There is a crash instead of a clean exit). I ran purify, glowcode and True
coverage on my application and found out that the memory leak is NOT in vtk.
MFC behaves strangely when you load multiple mixed dlls. MSDN claims that
these are not

Really leaks, but report of error ( the MSDN title and question number are
attached below) which can be ignored.(could say typical of Microsoft). But
what should be noted is that when there is an error (an actual memory leak )
in your dll then also it gives you the same error message. So it is left up
to you to verify in which category you belong.

 

Also  if you are using smart pointers in your application (along with
multiple dlls) beware, if the exit sequences of the dlls are not alright
then these smart pointers do not get freed smarlty you have to manually call
a Release() on these pointers. 

 

Therefore I would suggest to completely test your application for memory
leaks (purify has a trial release of their tool for free) 

With and without vtk. I think vtk is tested with purify (that is what I was
told when I raised the question few months ago)

 

Also you could follow MSDNs  tips for memory leak detection. It involves

 #define _CRTDBG_MAP_ALLOC and making every malloc with  _malloc_dbg
(correspondingly free) and _CrtDumpMemoryLeaks(); for dumping memory
information .It is a quick test to see if there are actually any leaks in
the 

code. - if you need tips on this I can send you the link

 

Again, if you are using com/ole32 you might find some memory leaks. This is
a known leak from Microsoft. 

 

If you have any questions or comments please let me know. Since I an using
win32 vtk application, multiple dlls 

And had the similar problem few months ago I might be able to
verify/test/respond to these comments.

 

MSDN : ref



PRB: Memory Leaks Reported When Using Multiple MFC DLLs


Q167929

 

Regards

Gowri

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20020228/2306fd5b/attachment.htm>


More information about the vtkusers mailing list