Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
AfxEnableMemoryTracking
TRY
Collapse the table of content
Expand the table of content

AfxEnableMemoryTracking 

Diagnostic memory tracking is normally enabled in the Debug version of MFC.


BOOL AfxEnableMemoryTracking(
   BOOL bTrack 
); 

Parameters

bTrack

Setting this value to TRUE turns on memory tracking; FALSE turns it off.

The previous setting of the tracking-enable flag.

Use this function to disable tracking on sections of your code that you know are allocating blocks correctly.

For more information on AfxEnableMemoryTracking, see Debugging MFC Applications.

NoteNote

This function works only in the Debug version of MFC.

BOOL CWinMyApp::InitInstance()
{
  #ifdef _DEBUG
    // Disable tracking of memory for the scope of the InitInstance()
    AfxEnableMemoryTracking(FALSE);
  #endif  // _DEBUG

    ...
    ...

  #ifdef _DEBUG
    // Re-enable tracking of memory
    AfxEnableMemoryTracking(TRUE);
  #endif  // _DEBUG
}

Community Additions

ADD
Show:
© 2015 Microsoft