Compact 2013: Memory Leak Functions RRS feed

  • Question

  • It appears that the memory leak function '_CrtDumpMemoryLeaks' is buggy in Compact 2013 compared to the desktop. When I use this function in a desktop MFC application, I simply need to add the following to the top of the file and I get meaningful memory leak output at the end of the program.

    #ifdef _DEBUG
    #define _CRTDBG_MAP_ALLOC  
    #define new DEBUG_NEW

    The meaningful Visual Studio 2015 output I get is:

    Detected memory leaks!
    Dumping objects ->
    c:\users\jared.hagel\documents\visual studio 2015\projects\mfcapplication14\mfcapplication14.cpp(76) : {165} normal block at 0x00836980, 5 bytes long.
     Data: <Hello> 48 65 6C 6C 6F 
    Object dump complete.

    This occurs when I intentionally include the following memory leak in the program:

    	char* localLeak = new char[5];
    	localLeak[0] = 'H';
    	localLeak[1] = 'e';
    	localLeak[2] = 'l';
    	localLeak[3] = 'l';
    	localLeak[4] = 'o';

    However, if I include this same header and memory leak to my Compact 2013 MFC program, I get the following Visual Studio 2015 output:

    Detected memory leaks!
    Dumping objects ->
    Àú(157) : {226} normal block at 0x00202ED0, 5 bytes long.
     Data: <效汬o﻾> 㠴㘠‵䌶㘠⁃䘶 ﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾﻾þ
    Object dump complete.

    So it appears the Compact 2013 MFC Application is struggling to output the filename and data compared to the desktop MFC application. Has anybody else run into this problem and found a workaround?

    Monday, November 27, 2017 6:35 PM