Archived

This forum has been archived. Please start a new discussion on GitHub.

With MFC, memory leak?

I use dialog-based MFC program, every ice-related thing is running in a thread created by this line in OnInitDialog():
g_hthread = (HANDLE)_beginthread(RunPatch,0, &g_mypar);

then, in OnDestroy():
if (g_hthread)
::WaitForSingleObject(g_hthread, INFINITE);

At last, I find some exceptions and many memory leak items in debug window:
NetorLiveUpdateClid.exe 0x77e6a4e1 exceptionF0x000006BA: RPC server not avail B
UpdateClid.exe 0x77f81d96 exceptionF0xC0000005: read location 0xfffffffd B
UpdateClid.exe 0x77f81d96 exceptionF0xC0000005: read location 0xfffffffd
...

Detected memory leaks!
Dumping objects ->
{549} normal block at 0x018C0168, 12 bytes long.
Data: < 9k k > 88 39 6B 00 E0 FF 6B 00 10 01 8C 01
{548} normal block at 0x018C0110, 24 bytes long.
Data: <88 > 38 38 15 00 FF FF FF FF 00 00 00 00 00 00 00 00
{547} normal block at 0x006BFFE0, 12 bytes long.
Data: <h P k > 68 01 8C 01 50 9D 6B 00 B8 00 8C 01
{546} normal block at 0x018C00B8, 24 bytes long.
Data: < 8 > 18 38 15 00 FF FF FF FF 00 00 00 00 00 00 00 00
{536} normal block at 0x018C0068, 16 bytes long.
Data: <t % > 74 82 25 00 01 00 00 00 00 CD CD CD CC 09 00 00
{535} normal block at 0x006BFF18, 140 bytes long.
Data: < % % 7 > B8 81 25 00 C0 81 25 00 B8 37 15 00 FF FF FF FF
{534} normal block at 0x006B9D50, 12 bytes long.
Data: < k 0ak k > E0 FF 6B 00 30 61 6B 00 C0 FE 6B 00
{533} normal block at 0x006BFEC0, 24 bytes long.
Data: < 7 > 98 37 15 00 FF FF FF FF 00 00 00 00 00 00 00 00
{451} normal block at 0x006BDF48, 44 bytes long.
Data: < > E0 A9 13 00 FF FF FF FF 00 00 00 00 00 00 00 00
{442} normal block at 0x006BEEB0, 32 bytes long.
Data: <tcp -p 10000 -h > 74 63 70 20 2D 70 20 31 30 30 30 30 20 2D 68 20
{441} normal block at 0x006BEFF8, 32 bytes long.
Data: <IcePatch.Endpoin> 49 63 65 50 61 74 63 68 2E 45 6E 64 70 6F 69 6E
{440} normal block at 0x006BEF70, 72 bytes long.
Data: < k k k > 00 EA 6B 00 E8 EA 6B 00 00 EA 6B 00 CD CD CD CD
{416} normal block at 0x006BEB70, 32 bytes long.
Data: <NetorLiveUpdateC> 4E 65 74 6F 72 4C 69 76 65 55 70 64 61 74 65 43
{415} normal block at 0x006BEAE8, 72 bytes long.
Data: < k k p k > 00 EA 6B 00 00 EA 6B 00 70 EF 6B 00 CD CD CD CD
{413} normal block at 0x006BEA00, 72 bytes long.
Data: < k k p k > E8 EA 6B 00 E8 EA 6B 00 70 EF 6B 00 CD CD CD CD
{409} normal block at 0x006BE7D8, 64 bytes long.
Data: < D > 00 DC 14 10 44 DC 14 10 C0 A9 13 00 FF FF FF FF
{280} normal block at 0x006B9E78, 32 bytes long.
Data: <::Glacier::Passw> 3A 3A 47 6C 61 63 69 65 72 3A 3A 50 61 73 73 77
{279} normal block at 0x006B9FC8, 32 bytes long.
Data: <::Glacier::Start> 3A 3A 47 6C 61 63 69 65 72 3A 3A 53 74 61 72 74
{278} normal block at 0x006B9F58, 48 bytes long.
Data: <::Glacier::Canno> 3A 3A 47 6C 61 63 69 65 72 3A 3A 43 61 6E 6E 6F
{277} normal block at 0x006B9EE8, 52 bytes long.
Data: < ak k ak > E8 61 6B 00 98 9D 6B 00 E8 61 6B 00 CD CD CD CD
{274} normal block at 0x006B9CB8, 12 bytes long.
Data: < ZU > C4 5A 55 00 02 00 00 00 00 CD CD CD
{273} normal block at 0x006B9E08, 48 bytes long.
Data: <::Glacier::Inval> 3A 3A 47 6C 61 63 69 65 72 3A 3A 49 6E 76 61 6C
{272} normal block at 0x006B9D98, 52 bytes long.
Data: < k 0 k ak > E8 9E 6B 00 30 9B 6B 00 E8 61 6B 00 CD CD CD CD
{269} normal block at 0x006B9C70, 12 bytes long.
Data: < ZU > B4 5A 55 00 02 00 00 00 00 CD CD CD
{268} normal block at 0x006B9C10, 32 bytes long.
Data: <::Glacier::Sessi> 3A 3A 47 6C 61 63 69 65 72 3A 3A 53 65 73 73 69
{267} normal block at 0x006B9AB0, 32 bytes long.
Data: <::Glacier::Sessi> 3A 3A 47 6C 61 63 69 65 72 3A 3A 53 65 73 73 69
{266} normal block at 0x006B9A50, 32 bytes long.
Data: <::Glacier::Route> 3A 3A 47 6C 61 63 69 65 72 3A 3A 52 6F 75 74 65
{265} normal block at 0x006B9BA0, 48 bytes long.
Data: <::Glacier::NoSes> 3A 3A 47 6C 61 63 69 65 72 3A 3A 4E 6F 53 65 73
{264} normal block at 0x006B9B30, 52 bytes long.
Data: < k (dk hek > 98 9D 6B 00 28 64 6B 00 68 65 6B 00 CD CD CD CD
{261} normal block at 0x006B9A08, 12 bytes long.
Data: <|SU > 7C 53 55 00 02 00 00 00 00 CD CD CD
{259} normal block at 0x006B9698, 24 bytes long.
Data: < k k k > 98 96 6B 00 98 96 6B 00 98 96 6B 00 CD CD CD CD
{256} normal block at 0x006B9768, 32 bytes long.
Data: <::IcePatch::Regu> 3A 3A 49 63 65 50 61 74 63 68 3A 3A 52 65 67 75
{255} normal block at 0x006B96F8, 52 bytes long.
Data: <Xbk H k Xbk > 58 62 6B 00 48 91 6B 00 58 62 6B 00 CD CD CD CD
{253} normal block at 0x006B9640, 28 bytes long.
Data: < ^+ ^+ ^+ > A8 5E 2B 00 C0 5E 2B 00 9C 5E 2B 00 02 00 00 00
{252} normal block at 0x006B95E0, 32 bytes long.
Data: <::IcePatch::Regu> 3A 3A 49 63 65 50 61 74 63 68 3A 3A 52 65 67 75
{251} normal block at 0x006B9580, 32 bytes long.
Data: <::IcePatch::File> 3A 3A 49 63 65 50 61 74 63 68 3A 3A 46 69 6C 65
{250} normal block at 0x006B9520, 32 bytes long.
Data: <::IcePatch::Regu> 3A 3A 49 63 65 50 61 74 63 68 3A 3A 52 65 67 75
{249} normal block at 0x006B93F0, 32 bytes long.
Data: <::IcePatch::File> 3A 3A 49 63 65 50 61 74 63 68 3A 3A 46 69 6C 65
{248} normal block at 0x006B94C0, 32 bytes long.
Data: <::IcePatch::Dire> 3A 3A 49 63 65 50 61 74 63 68 3A 3A 44 69 72 65
{247} normal block at 0x006B9450, 52 bytes long.
Data: <Xbk H k Xbk > 58 62 6B 00 48 91 6B 00 58 62 6B 00 CD CD CD CD
{245} normal block at 0x006B9398, 28 bytes long.
Data: <X^+ p^+ L^+ > 58 5E 2B 00 70 5E 2B 00 4C 5E 2B 00 02 00 00 00
{244} normal block at 0x006B9338, 32 bytes long.
Data: <::IcePatch::File> 3A 3A 49 63 65 50 61 74 63 68 3A 3A 46 69 6C 65
{243} normal block at 0x006B92D8, 32 bytes long.
Data: <::IcePatch::Dire> 3A 3A 49 63 65 50 61 74 63 68 3A 3A 44 69 72 65
{242} normal block at 0x006B9278, 32 bytes long.
Data: <::IcePatch::File> 3A 3A 49 63 65 50 61 74 63 68 3A 3A 46 69 6C 65
{241} normal block at 0x006B9218, 32 bytes long.
Data: <::IcePatch::Dire> 3A 3A 49 63 65 50 61 74 63 68 3A 3A 44 69 72 65
{240} normal block at 0x006B90E8, 32 bytes long.
Data: <::IcePatch::File> 3A 3A 49 63 65 50 61 74 63 68 3A 3A 46 69 6C 65
{239} normal block at 0x006B91B8, 32 bytes long.
Data: <::IcePatch::File> 3A 3A 49 63 65 50 61 74 63 68 3A 3A 46 69 6C 65
{238} normal block at 0x006B9148, 52 bytes long.
Data: <P k Xbk k > 50 94 6B 00 58 62 6B 00 F8 96 6B 00 CD CD CD CD
{236} normal block at 0x006B8EA0, 28 bytes long.
Data: < ^+ ^+ ]+ > 08 5E 2B 00 20 5E 2B 00 FC 5D 2B 00 02 00 00 00
{235} normal block at 0x006B8E40, 32 bytes long.
Data: <::IcePatch::File> 3A 3A 49 63 65 50 61 74 63 68 3A 3A 46 69 6C 65
{234} normal block at 0x006B9088, 32 bytes long.
Data: <::IcePatch::Busy> 3A 3A 49 63 65 50 61 74 63 68 3A 3A 42 75 73 79



... ...

Comments

  • Ice has been tested with MFC many times, and there are no known memory leaks.

    Unfortunately, with the information you provide it is impossible to say what the reason for the leak you are experiencing might be. We would need to see a small, self-contained example that demonstrates the problem.
  • The problem example code

    I just want to try IcePatch in a small dialog mfc program and display a progress control.

    IcePatch's code is copy from your source code and run in a single thread.
    When thread running, I just test its existing in OnTimer, if it return from thread, I just close dialog.

    If you just run it, will see what I see...:(

    BTW:I use VC70 and attachment is whole project compress(ZIP) file. Please just give a look.
  • I have no idea what memory debugger this is, but perhaps you should check your program with Purify. First purify IcePatch itself, and then your modified version.

    I don't know anything about DEBUG_NEW, and therefore cannot comment on the debug output.
  • DEBUG_NEW is produced by VC70's project wizard. I find your Ice source code is also can be built by VC70 or VC71.