Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How you find memory leaks?

Answers were Sorted based on User's Feedback



How you find memory leaks?..

Answer / jawahar

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

Is This Answer Correct ?    8 Yes 0 No

How you find memory leaks?..

Answer / umesh pai

There is a pretty easiest way to identify whether ur application is having any memory leak. By using the macro called DEBUG_NEW

define this macro on each of urs cpp file.
like #define DEBUG_NEW

then if u run once ur application in debug mode, it will show each variable which has not been released the memory properly.

Is This Answer Correct ?    8 Yes 3 No

How you find memory leaks?..

Answer / gopal sodhani

macro should be
#define new DEBUG_NEW, in such case once you insert this
directive, the preprocessor will insert DEBUG_NEW wherever
you use new, and MFC does the rest.

Is This Answer Correct ?    4 Yes 0 No

How you find memory leaks?..

Answer / nibha

there are various tool like UMDH,DevPartner, through which
can get line number and function name where memory is
leaking

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More MFC Interview Questions

Tell me the work of HTREDUCE and HTZOOM

1 Answers   E Logic,


Does the application have more than one object? If no, then what is the reason?

5 Answers  


What is Thread ?(VC++)What is the difference between Cmutex and Csemaphone?

5 Answers   Atos Origin,


how to give colour for dialog button or static buuto?any one explain full code ?pls pls

3 Answers  


What are the differences between MFC Exception macros and C++ exception keywords?

2 Answers  


how do u identify RTTI in vc++

4 Answers   Siemens,


Explain about MDI and CMultiDocTemplate ?

2 Answers  


What is the difference between the ASSERT and VERIFY macros?

4 Answers  


In VC++ How to transfer between one exe to another exe while running..

5 Answers   Wipro,


Which Macro is a Super set of other two macro DECLARE_SERIAL,DECLARE_DYNAMIC and DECLARE_DYNCREATE. ?

2 Answers   Sony,


If i derive a new class from CObject what are the basic features my derived wil get ?

4 Answers   Microsoft,


Which CPrintInfo member variable must be set for multiple page printouts?

1 Answers  


Categories