locked
Checking for memory overwrites in a C++/CX application

    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?

    Thanks,
    Bill.

    Thursday, August 01, 2013 6:00 PM

Answers

All replies

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

    Thursday, August 01, 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.

    Thanks,
    Bill.

    Friday, August 02, 2013 1:38 AM