Domanda

I am testing my dll that I created. It in turn use several other dlls. My Dll tester application reports memory leaks when I start the test application and exit without doing anything except loading dll using LoadLibrary. It doesn't show the exact files in my dll source code. There are no leaks if I don't load the dll. It is an MFC dll and has App class. I removed everything from the dll's app class so it does nothing but I still get memory leaks report when I load it. I created another set of dummy dll and test application but that doesn't report any leaks so it has to do with my original dll, perhaps its linkage with other dlls?

I have tried using _crtBreakAlloc = {allocation_#}; technique but it doesn't stop the debugger either. I am quite lost if this memory leak is real. I see from documentation it can report false positive. Could this be false positive just because my dll is linked to bunch of other dlls? I can't think of anything else because I have commented out all functionality from dll.

Here is the memory leak erros

Detected memory leaks!
Dumping objects ->
{250} client block at 0x00567E40, subtype c0, 64 bytes long.
a CDynLinkLibrary object at $00567E40, 64 bytes long
a CDynLinkLibrary object at $00567E40, 64 bytes long
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {244} normal block at 0x00567C20, 28 bytes long.
 Data: <   x            > E4 B8 07 78 05 00 00 00 05 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {243} normal block at 0x00567BC8, 28 bytes long.
 Data: <   x            > E4 B8 07 78 05 00 00 00 05 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {242} normal block at 0x00567B58, 52 bytes long.
 Data: <   x            > E4 B8 07 78 11 00 00 00 11 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {241} normal block at 0x00566C08, 40 bytes long.
 Data: <   x            > E4 B8 07 78 0B 00 00 00 0B 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {240} normal block at 0x00566BA8, 32 bytes long.
 Data: <   x            > E4 B8 07 78 07 00 00 00 07 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {239} normal block at 0x00566B50, 28 bytes long.
 Data: <   x            > E4 B8 07 78 05 00 00 00 05 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {238} normal block at 0x00566AE0, 46 bytes long.
 Data: <   x            > E4 B8 07 78 0E 00 00 00 0E 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {237} normal block at 0x00566A70, 48 bytes long.
 Data: <   x            > E4 B8 07 78 0F 00 00 00 0F 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {235} normal block at 0x005676B0, 42 bytes long.
 Data: <   x            > E4 B8 07 78 0C 00 00 00 0C 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {234} normal block at 0x00567658, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {233} normal block at 0x00567600, 28 bytes long.
 Data: <   x            > E4 B8 07 78 05 00 00 00 05 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {232} normal block at 0x00567590, 50 bytes long.
 Data: <   x            > E4 B8 07 78 10 00 00 00 10 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {231} normal block at 0x00567538, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {230} normal block at 0x005674E0, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {229} normal block at 0x00567488, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {228} normal block at 0x00567430, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {227} normal block at 0x005673D8, 24 bytes long.
 Data: <   x            > E4 B8 07 78 03 00 00 00 03 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {226} normal block at 0x00567380, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {225} normal block at 0x00567328, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {224} normal block at 0x005672C0, 40 bytes long.
 Data: <   x            > E4 B8 07 78 0B 00 00 00 0B 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {223} normal block at 0x00567268, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {222} normal block at 0x00567200, 44 bytes long.
 Data: <   x            > E4 B8 07 78 0D 00 00 00 0D 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {221} normal block at 0x00567198, 38 bytes long.
 Data: <   x            > E4 B8 07 78 0A 00 00 00 0A 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {220} normal block at 0x00567140, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {219} normal block at 0x005670E8, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {218} normal block at 0x00567080, 38 bytes long.
 Data: <   x            > E4 B8 07 78 0A 00 00 00 0A 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {217} normal block at 0x00567028, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {216} normal block at 0x00566FD0, 24 bytes long.
 Data: <   x            > E4 B8 07 78 03 00 00 00 03 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {215} normal block at 0x00566F78, 24 bytes long.
 Data: <   x            > E4 B8 07 78 03 00 00 00 03 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {214} normal block at 0x00566F18, 36 bytes long.
 Data: <   x            > E4 B8 07 78 09 00 00 00 09 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {213} normal block at 0x00566EC0, 24 bytes long.
 Data: <   x            > E4 B8 07 78 03 00 00 00 03 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {212} normal block at 0x00566E68, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {211} normal block at 0x00566E10, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {210} normal block at 0x00566DB8, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {209} normal block at 0x00566D60, 24 bytes long.
 Data: <   x            > E4 B8 07 78 03 00 00 00 03 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {208} normal block at 0x00566D08, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {207} normal block at 0x00566CB0, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {206} normal block at 0x00561918, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {205} normal block at 0x005618C0, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {204} normal block at 0x00561868, 28 bytes long.
 Data: <   x            > E4 B8 07 78 05 00 00 00 05 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {202} normal block at 0x005669F8, 60 bytes long.
 Data: <   x            > E4 B8 07 78 15 00 00 00 15 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {201} normal block at 0x00566988, 46 bytes long.
 Data: <   x            > E4 B8 07 78 0E 00 00 00 0E 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {200} normal block at 0x00566920, 42 bytes long.
 Data: <   x            > E4 B8 07 78 0C 00 00 00 0C 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {199} normal block at 0x005668C8, 28 bytes long.
 Data: <   x            > E4 B8 07 78 05 00 00 00 05 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {198} normal block at 0x00566868, 32 bytes long.
 Data: <   x            > E4 B8 07 78 07 00 00 00 07 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {197} normal block at 0x00566800, 44 bytes long.
 Data: <   x            > E4 B8 07 78 0D 00 00 00 0D 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {196} normal block at 0x00566790, 50 bytes long.
 Data: <   x            > E4 B8 07 78 10 00 00 00 10 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {195} normal block at 0x00566718, 60 bytes long.
 Data: <   x            > E4 B8 07 78 15 00 00 00 15 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {194} normal block at 0x005666C0, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {193} normal block at 0x00566040, 48 bytes long.
 Data: <   x            > E4 B8 07 78 0F 00 00 00 0F 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {192} normal block at 0x00561C98, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {81} normal block at 0x00561BA0, 32 bytes long.
 Data: <   x            > E4 B8 07 78 07 00 00 00 07 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {80} normal block at 0x00561B48, 28 bytes long.
 Data: <   x            > E4 B8 07 78 05 00 00 00 05 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {79} normal block at 0x00561AE0, 44 bytes long.
 Data: <   x            > E4 B8 07 78 0D 00 00 00 0D 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {78} normal block at 0x00561A80, 34 bytes long.
 Data: <   x            > E4 B8 07 78 08 00 00 00 08 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {77} normal block at 0x00561A20, 30 bytes long.
 Data: <   x            > E4 B8 07 78 06 00 00 00 06 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {76} normal block at 0x005613D0, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {75} normal block at 0x005619A8, 56 bytes long.
 Data: <   x            > E4 B8 07 78 13 00 00 00 13 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {74} normal block at 0x00561378, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {72} normal block at 0x005617F8, 48 bytes long.
 Data: <   x            > E4 B8 07 78 0F 00 00 00 0F 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {71} normal block at 0x005617A0, 28 bytes long.
 Data: <   x            > E4 B8 07 78 05 00 00 00 05 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {70} normal block at 0x00561748, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {69} normal block at 0x005616D0, 54 bytes long.
 Data: <   x            > E4 B8 07 78 12 00 00 00 12 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {68} normal block at 0x00561670, 34 bytes long.
 Data: <   x            > E4 B8 07 78 08 00 00 00 08 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {67} normal block at 0x00561618, 22 bytes long.
 Data: <   x            > E4 B8 07 78 02 00 00 00 02 00 00 00 01 00 00 00 
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {66} normal block at 0x005615B8, 36 bytes long.
 Data: <   x            > E4 B8 07 78 09 00 00 00 09 00 00 00 01 00 00 00 
Object dump complete.

Is there another way I can double check the memory leaks don't exist? I installed deleaker as well but it is buggy program, it holds on pdb files and was not releasing it...that caused me more pain.

È stato utile?

Soluzione

According to the following MSKB article, this is probably expected:

Memory leaks are reported when you use multiple MFC DLLs

Quoting from the linked page:

These memory leaks are reported when multiple versions of the MFC DLL are loaded in the same process. Since MFC extension (AFXDLL) DLLs require the exact same MFC DLL as the call application, this problem can only occur when using MFC regular (USRDLL) DLLs or ActiveX Controls (OCX) that use the shared version of MFC.

The most common case is mixing ANSI (MFC4xd.DLL) and UNICODE (MFC4xxUd.DLL) versions of MFC in the same process. This can also occur when mixing MFC42d.DLL and MFC40d.DLL.

And as far as resolving the "problem" goes:

These memory leak notifications are false, and can be ignored. Since neither copy of MFC knows about the other ones, it's not easy to stop these false leaks from being reported.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top