There is a known issue/BUG with MFC, were MFC makes a call to _CrtDumpMemoryLeaks() in the destructor of the _AFX_DEBUG_STATE, followed by _CrtSetDbgFlag() which sets it to ~_CRTDBG_LEAK_CHECK_DF (therefor disabling memory leak test at *true* program exit) This destructor is called at exit (i.e. atexit()), but before statics residing in dlls and others are destroyed, resulting in many false memory leaks are reported
As to fix any real memory leaks, you have the source ... also you can do a google to see how others have gotten around this issue to get at any real leaks. The MFC memory leak will not go away as Microsoft have no reason to fix it( it been there for many years) as MFC is a deprecated API as far as they are concerned Best Regards Gordon __________________________________________________________ Gordon Tomlinson Email : gordon.tomlinson @ overwatch.com YIM/AIM: Gordon3dBrit MSN IM : Gordon3dBrit @ 3dSceneGraph.com __________________________________________________________ Telephone (Cell): (+1) 214-477-8914 Telephone (Work): (+1) 703-437-7651 "Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival" - Master Tambo Tetsura -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Guy Lifchitz Sent: Thursday, January 04, 2007 1:54 PM To: [email protected] Subject: [osg-users] Using MFC and OSG causes memory leaks Hi, I'm trying to use the OSG engine with console application that also requires the MFC (at list part of it), anyway, as soon as I include the afx.h file, memory leaks are appearing. The memory leaks are caused by global variables that appear in the OSG libraries. (some of them are RenderBin, DisplayProperties and others), all the variables that I manually allocate in the code, are freed correctly. When I don't use the MFC (and comment out the relevant code) the memory leaks disappear. I think it has something to do with redefinition of the new and delete operators when using MFC, but I couldn't figure it out. Thanks, Guy.
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
