IrrIMGUI  0.3.1
Public Member Functions | Private Attributes | List of all members
IrrIMGUI::Tools::CBasicMemoryLeakDetection Class Reference

This is a very basic memory leak detection for Windows Systems. More...

#include <CBasicMemoryLeakDetection.h>

Public Member Functions

 CBasicMemoryLeakDetection (void)
 Constructor will store the current memory state. More...
 
 ~CBasicMemoryLeakDetection (void)
 The Destructor will compare the current memory state with the stored one. More...
 
int compareMemoryState (void)
 Compares the current memory state with the stored one. More...
 
void resetMemoryState (void)
 Resets the memory state to prepare a new detection. More...
 

Private Attributes

bool mWasMemoryChecked
 

Detailed Description

This is a very basic memory leak detection for Windows Systems.

When creating an object of this class, it will store the current state of the memory. And when this object is destroyed, it will compare the state of the memory with the stored one. Thus it can detect differences in memory usage.

It will not show you any more information than just the difference of the both memory states.

Attention
This class has only a functionality for Windows, compiled with Visual C++. When someone knows how to perform the same checks with MingW/GCC without using non-standard libraries, please tell me. For non Windows or Visual C++ compilers the class will compile but it will just do nothing.
#include <IrrIMGUI/Tools/BasicMemoryLeakDetection.h>
int main(void)
{
// just create an object of this class.
// ... write your code here ...
// when the object is destroyed, it will throw automatically an assertion,
// if there is less memory left than on creation (an indication of a memory leak)
return 0;
}

Definition at line 91 of file CBasicMemoryLeakDetection.h.

Constructor & Destructor Documentation

IrrIMGUI::Tools::CBasicMemoryLeakDetection::CBasicMemoryLeakDetection ( void  )

Constructor will store the current memory state.

Definition at line 40 of file CBasicMemoryLeakDetection.cpp.

Here is the call graph for this function:

IrrIMGUI::Tools::CBasicMemoryLeakDetection::~CBasicMemoryLeakDetection ( void  )

The Destructor will compare the current memory state with the stored one.

Definition at line 46 of file CBasicMemoryLeakDetection.cpp.

Here is the call graph for this function:

Member Function Documentation

int IrrIMGUI::Tools::CBasicMemoryLeakDetection::compareMemoryState ( void  )

Compares the current memory state with the stored one.

Returns
Returns the number of bytes that are different between both states (should be 0 when no memory leak occurred).

Definition at line 59 of file CBasicMemoryLeakDetection.cpp.

Here is the caller graph for this function:

void IrrIMGUI::Tools::CBasicMemoryLeakDetection::resetMemoryState ( void  )

Resets the memory state to prepare a new detection.

Definition at line 90 of file CBasicMemoryLeakDetection.cpp.

Here is the caller graph for this function:

Member Data Documentation

bool IrrIMGUI::Tools::CBasicMemoryLeakDetection::mWasMemoryChecked
private

Definition at line 111 of file CBasicMemoryLeakDetection.h.


The documentation for this class was generated from the following files: