Re: strange memory leak problem
Hi,
The one I am working is a COM DLL, here is the code where I put
_CrtDumpMemoryLeaks(), is it the right place for this function to
detect mem leak in a DLL?
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /
*lpReserved*/)
{
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
_CrtSetBreakAlloc(113);
if (dwReason == DLL_PROCESS_ATTACH)
{
_Module.Init(ObjectMap, hInstance, &LIBID_TBSDKLib);
DisableThreadLibraryCalls(hInstance);
}
else if (dwReason == DLL_PROCESS_DETACH) {
_Module.Term();
_CrtDumpMemoryLeaks();
}
// get the dll full path (not the process the dll is attached to)
DWORD dwSize = GetModuleFileName
( reinterpret_cast< HMODULE >( hInstance )
, g_InstallDir
, MAX_PATH );
return TRUE; // ok
}
Thanks
Timmy
On Aug 30, 10:36 pm, "Giovanni Dicanio" <giovanni.dica...@invalid.it>
wrote:
"Joseph M. Newcomer" <newco...@flounder.com> ha scritto nel messaggionews:haidd3hkh7j6kuel2gcb744o9mqifco84i@4ax.com...
What does this citation have to do with the question?
A CString is being allocated on the stack. It cannot be a memory leak,
because any heap
space it uses will be freed when the variable leaves scope. So either the
question is
ill-formed, or there is insufficient context given to allow an evaluation
of the problem.
The OP's question showed no memory leaks, or at least: I could find no
memory leaks in the code he posted (maybe am I missing something?)
But the citation was about the *general* "memory leaks" problem in C++.
Gio