BazisLib::MemoryLeakDetector Class Reference

Provides a simple way of detecting memory leaks. More...

#include <memdbg.h>

Collaboration diagram for BazisLib::MemoryLeakDetector:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 MemoryLeakDetector ()
 ~MemoryLeakDetector ()

Static Private Member Functions

static int DebugAllocHook (int allocType, void *userData, size_t size, int blockType, long requestNumber, const unsigned char *filename, int lineNumber)

Private Attributes

AtomicInt32 m_AllocationCount

Static Private Attributes

static MemoryLeakDetectorpDetector = NULL
 Contains the pointer to the only MemoryLeakDetector instance.
static _CRT_ALLOC_HOOK pPrevHook = NULL


Detailed Description

Provides a simple way of detecting memory leaks.

To add memory leak detection to your application, perform the following steps:

In that case at the end of the main() function you'll get either a message in the debug output window stating that no memory leaks are detected, or an assertion fail on the allocation count checking code.

Constructor & Destructor Documentation

BazisLib::MemoryLeakDetector::MemoryLeakDetector (  )  [inline]

Here is the call graph for this function:

BazisLib::MemoryLeakDetector::~MemoryLeakDetector (  )  [inline]

If you got a break here, examine the m_AllocationCount parameter


Member Function Documentation

static int BazisLib::MemoryLeakDetector::DebugAllocHook ( int  allocType,
void *  userData,
size_t  size,
int  blockType,
long  requestNumber,
const unsigned char *  filename,
int  lineNumber 
) [inline, static, private]


Member Data Documentation

Contains the pointer to the only MemoryLeakDetector instance.

Attention:
If you see the 'symbol MemoryLeakDetector::pDetector already defined' error, you have mistakingly included the memdbg.h file from multiple files in your project, that is an incorrect use. Please include it only from the file containing main() function.

_CRT_ALLOC_HOOK BazisLib::MemoryLeakDetector::pPrevHook = NULL [static, private]


The documentation for this class was generated from the following file:
SourceForge.net Logo