Interviewer And Interviewee Guide

Microsoft Foundation Class (MFC) Interview Question:

How you find memory leaks?

Submitted by: Administrator
There many ways to find memory leaks, One of the ways is by
using MFC class. And another way is using Purify tools...

CMemorState is a MFC class by which we can find the memory
leaks. Below is a sample code to find the same.

#ifdef _DEBUG
CMemoryState oldState, newState, diffState;
oldState.Checkpoint();
#endif
int* a = new int[10];
#ifdef _DEBUG
newState.Checkpoint();
if(diffState.Difference(oldState, newState))
{
TRACE0("Memory Leaked");
}
#endif
Submitted by: Administrator

Read Online Microsoft Foundation Class (MFC) Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.