\mfc\dumpcont.cpp(23) : atlTraceGeneral 内存泄漏

677 阅读1分钟

Detected memory leaks!
Dumping objects ->
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {4873} normal block at 0x069959A0, 26 bytes long.
Data: <x               > 78 C5 9C 0F 09 00 00 00 09 00 00 00 01 00 00 00 
{97} client block at 0x003F9D30, subtype c0, 64 bytes long.
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dumpcont.cpp(23) : atlTraceGeneral - a CDynLinkLibrary object at $003F9D30, 64 bytes long
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dumpcont.cpp(23) : atlTraceGeneral - a CDynLinkLibrary object at $003F9D30, 64 bytes long
Object dump complete.

 

内存泄露的原因:

BOOL CSmartApp::InitInstance()

{

m_hLangDLL = ::LoadLibrary(_T("LangEnglish.dll"));

}

没有释放动态库。

int CSmartApp::ExitInstance()
{

if (NULL != m_hLangDLL)
{
AfxFreeLibrary(m_hLangDLL);//不可使用::FreeLibrary()函数,会内存泄露
}

}