have no idea, how redefining (or rather not defining) macros active for the application code could solve a memory leak report stemming from static data inside Ogre.

At least for me, I had the same leak reports and they didn't go away with the given recipe. After some debugging, the reason for the reports turned out to be a loading order problem:

i) OgreMain_d.dll is loaded
ii) mfc80d.dll is loaded
iii) application runs...
iv) mfc80d.dll is unloaded
v) OgreMain_d.dll is unloaded.

The leak report occurs in stage (iv): MFC triggers a leak report without relying on the crt to do it at program shutdown. Thus, static data allocated by Ogre is reported as leaking (because OgreMain_d.dll is still active).

The solution is to force the linker to load MFC before Ogre, which can be done like this (only do this for debug builds):

i) in the General tab, switch "Use MFC in a shared DLL" to "Use Standard Windows Libraries"
ii) in the C/C++/Preprocessor tab, add _AFXDLL to the preprocessor definitions
iii) in the Linker/Input tab, add mfc80d.lib anywhere before OgreMain_d.lib

Only doing the last step won't help - the general setting takes precedence.

 

http://www.ogre3d.org/phpBB2/viewtopic.php?t=32675&view=next&sid=ce193664e1d3d7c4af509e6f4e2718c6

http://www.google.com/custom?domains=www.ogre3d.org&sitesearch=www.ogre3d.org&q=exit+memery+leak&hq=site%3Awww.ogre3d.org&client=pub-3579678752126977&forid=1&ie=ISO-8859-1&oe=ISO-8859-1&cof=GALT%3A%23008000%3BGL%3A1%3BDIV%3A%23215670%3BVLC%3A663399%3BAH%3Acenter%3BBGC%3AFFFFFF%3BLBGC%3AFFFFFF%3BALC%3A0000FF%3BLC%3A0000FF%3BT%3A000000%3BGFNT%3A0000FF%3BGIMP%3A0000FF%3BLH%3A100%3BLW%3A250%3BL%3Ahttp%3A%2F%2Fwww.ogre3d.org%2Ftemplates%2Fogre%2Fimages%2Fogre-logo.gif%3BS%3Ahttp%3A%2F%2Fwww.ogre3d.org%3BFORID%3A1%3B&hl=en