[vtkusers] Memory leaks....

echinococcus Multilocularis lintworm2 at yahoo.co.uk
Sun Oct 29 16:36:56 EST 2006


Thank you for your response. I did what you suggested, to be precise, the second option. I added the linker option /DELAYLOAD:vtkMFC.dll. (I use vtkRendering.dll as well, should this one be delayed as well?) However, the result was now that there was an unresolved symbol:

vtkMFC.lib(vtkMFC.dll) : error LNK2001: unresolved external symbol ___delayLoadHelper at 8
Debug/VTKStart.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

After a little googling, i noticed i should add the lib: Delayimp.lib. So i added the lib, and the compilation went fine again. However, now, the memory leaks returned. Is there something else wrong, or am i forgetting something?

Secondly, if i were to go the other path, which files do I have to download? Only the files that are in the GUISupport/MFC/ or others as well?

Thank you again for your response.

Sincerely,
Han
----- Original Message ----
From: David Cole <david.cole at kitware.com>
To: echinococcus Multilocularis <lintworm2 at yahoo.co.uk>
Cc: vtkusers at vtk.org
Sent: Sunday, 29 October, 2006 5:56:43 PM
Subject: Re: [vtkusers] Memory leaks....

The problem is that VTK dlls are loaded before the MFC dll, and at shutdown time, the MFC dll is unloaded before the VTK dlls... And when the MFC dll unloads, it does a memory leak check and incorrectly reports that all the VTK objects still left are leaks. 

You can overcome this by updating VTK to the CVS version and rebuilding VTK with VTK_USE_GUISUPPORT and VTK_USE_MFC  turned on. I recently added flags to the CMakeLists to eliminate these false memory leak reports. 

Alternatively, you can use the /DELAYLOAD linker flag to force the VTK dlls to be loaded after the MFC dll and then they will also be unloaded prior to the MFC dll. Then any leak reports that you see will be for real... (This is what I added in CVS VTK to fix the problem.) 

HTH,
David



On 10/29/06, echinococcus Multilocularis <lintworm2 at yahoo.co.uk> wrote: 
Hello all,

I finally got my M$ VC project working, using vtkMFCWindow. In this program i read some geometrical data from disk using my own readerfunction. I then display it using vtkMFCWindow. That all works fine, until i close the program and clean up the memory. At the end of program i get a message that memory leaks are detected. The problem is, that i really have no clue where they are from. When i look at the data dumped by VC, i find references to all kinds of objects i never have used. Can anybody tell me what i am doing wrong, or give me any other clues? I have build my program mostly using the examples given for vtkMFCWindow, however, also these examples give me the same problems. 

Thanking in advance,

Han

Send instant messages to your online friends http://uk.messenger.yahoo.com 

_______________________________________________
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

Send instant messages to your online friends http://uk.messenger.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061029/59dc6df2/attachment.htm>


More information about the vtkusers mailing list