Checking for memory overwrites in a C++/CX application RRS feed

  • Question

  • My application is crashing when it tries to free memory.  It appears that some part of it must be overwriting memory.  Is there a way to set afxMemDF or something similar for C++/CX apps?

    I tried including afx.h and adding:

    afxMemDF = allocMemDF | checkAlwaysMemDF;

    during my program's initialization, but I get errors regarding afx.h.

    Is this supposed to work for C++/CX apps or is it only for MFC? is there an alternative tool or interface that does the same thing?


    Thursday, August 1, 2013 6:00 PM


All replies

  • You can try the Visual C++ CRT debug heap: http://msdn.microsoft.com/en-us/library/974tc9t1.aspx

    Thursday, August 1, 2013 6:53 PM
  • That's exactly what I was looking for.  My program is crashing in free (the debugger shows free calling HeapFree when it crashes).  The boundary tags appear to be intact, and unfortunately turning on heap checking on ever free did not find the problem immediately, so I have a bit more work to do, but this gets me closer.


    Friday, August 2, 2013 1:38 AM