void CMLeakView::OnDraw(CDC* pDC) { CMLeakDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); CFont* pOFont; pOFont = pDC->SelectObject(&NFont); pDC->TextOut(20, 200, pDoc->myCString); pDC->SelectObject(pOFont); DeleteObject(pOFont); #ifdef _DEBUG newMemState.Checkpoint(); if (diffMemState.Difference(oldMemState,newMemState)) { TRACE("\n\nDifference between start and finish!"); newMemState.DumpStatistics(); } #endif }
void CWedApp::OnAppAbout() { CAboutDlg aboutDlg; // Declare the variables needed #ifdef _DEBUG static CMemoryState oldMemState3, newMemState3, diffMemState3; #endif #ifdef _DEBUG oldMemState3.Checkpoint(); #endif aboutDlg.DoModal(); #ifdef _DEBUG newMemState3.Checkpoint(); if( diffMemState3.Difference( oldMemState3, newMemState3 ) ) { oldMemState3.DumpAllObjectsSince(); //P2N("CDialog Memory leaked!\r\n"); //TRACE( "CDialog Memory leaked!\n" ); } #endif }
CMainFrame::~CMainFrame() { #ifdef _DEBUG newMemState.Checkpoint(); if( diffMemState.Difference( oldMemState, newMemState ) ) { //P2N("Mainfrm Memory leaked!\r\n"); //TRACE("Mainframe Diff dump\n"); //diffMemState.DumpAllObjectsSince(); //TRACE( "Memory leaked!\n" ); } #endif }
CWedDoc::~CWedDoc() { #ifdef _DEBUG //oldMemState.DumpAllObjectsSince(); //newMemState.Checkpoint(); if( diffMemState.Difference( oldMemState, newMemState ) ) { //P2N("WedDoc Memory leaked!\r\n"); //TRACE( "Memory leaked!\n" ); } #endif }