Guiliani  Version 2.5 revision 6773 (build 33)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CGUIMemLeakDetection Class Reference

Class CGUIMemLeakDetection for analyzing the use of memory and detecting the memory leaks. More...

#include <GUIMemLeakDetection.h>

Public Member Functions

const eC_UInt GetCurrentlyLargestObject () const
 
const eC_UInt GetLargestObject () const
 
const eC_UInt GetMaxObject () const
 
const eC_UInt GetUsedMemory () const
 
void SetActive (const eC_Bool &bActive)
 
void ShowResults ()
 
void WriteResultsToFile (const eC_Char *sFilename="MemoryAnalysisResults.log", const eC_Bool &bAsTable=true)
 

Static Public Member Functions

static CGUIMemLeakDetectionGetInstance ()
 

Friends

void Guiliani_delete (void *pMemory, const char *pFile, int iLine, const char *pFunction)
 
void Guiliani_deleteArray (void *pMemory, const char *pFile, int iLine, const char *pFunction)
 
void Guiliani_free (void *pMemory, const char *pFile, int iLine, const char *pFunction)
 
void * Guiliani_malloc (size_t uiSize, const char *pFile, int iLine, const char *pFunction)
 
void * Guiliani_new (size_t uiSize, const char *pFile, int iLine, const char *pFunction)
 
void * Guiliani_newArray (size_t uiSize, const char *pFile, int iLine, const char *pFunction)
 
void * Guiliani_realloc (void *pMemory, size_t uiSize, const char *pFile, int iLine, const char *pFunction)
 
void operator delete (void *Memory) throw ()
 
void operator delete[] (void *Memory) throw ()
 
void * operator new (size_t uiSize, const char *pcFile, int iLine, const char *pcFunction)
 
void * operator new[] (size_t uiSize, const char *pcFile, int iLine, const char *pcFunction)
 

Detailed Description

Class CGUIMemLeakDetection for analyzing the use of memory and detecting the memory leaks.

Include GUIMemLeakFuntions.h in the same file where the main() function is implemented. To show the results of leak detection call ShowResults() at the end. Don't use the new operator in this class, otherwise there will be a recursive new operator call until you'll have a stack overflow and the application crashes!

Attention
CGUIMemLeakDetection IS NOT THREAD-SAFE! USE IT CAREFULLY, ESPECIALLY WHILE USING IT IN COMMANDS.
Be aware then memleakdetection will only work for .cpp files in which GUIMemLeakWatcher.h was included as the last include statement!
#include "GUIMemLeakFunctions.h"
#include "GUIMemLeakWatcher.h"
int main()
{
//some code here
...
// Call this at the end to show the leak detection results on
// currently registered output device (console, etc.).
LEAK_DETECTION.ShowResults();
return 0;
}
// Example of leak detection results.
// The output shows the file, line number and function
// where the not freed allocation happened.
DEBUG: ---------- Guiliani memoryleak detection information ----------
DEBUG: ---------- Leak detected ----------
DEBUG: File: ..\MainWindow.cpp
DEBUG: Line: 530
DEBUG: Function: CMainWindow::PopulateTable
DEBUG: Adress: 0xd8c900

Member Function Documentation

const eC_UInt CGUIMemLeakDetection::GetCurrentlyLargestObject ( ) const

Get the memory used by the largest object

Returns
memory used by the largest object in bytes
static CGUIMemLeakDetection& CGUIMemLeakDetection::GetInstance ( )
inlinestatic

Method which returns the instance of this class.

Returns
instance of this class
const eC_UInt CGUIMemLeakDetection::GetLargestObject ( ) const

Get the memory used by the largest object

Returns
memory used by the largest object in bytes
const eC_UInt CGUIMemLeakDetection::GetMaxObject ( ) const

Get the max amount of memory ever allocated during runtime

Returns
maximum amount of allocated memory in bytes
const eC_UInt CGUIMemLeakDetection::GetUsedMemory ( ) const

Get the currently amount of used memory

Returns
used memory in bytes
void CGUIMemLeakDetection::SetActive ( const eC_Bool &  bActive)

Set enhanced memory-profiling active

Parameters
bActive
void CGUIMemLeakDetection::ShowResults ( )

Method which shows results on screen uses GUILOG.

void CGUIMemLeakDetection::WriteResultsToFile ( const eC_Char *  sFilename = "MemoryAnalysisResults.log",
const eC_Bool &  bAsTable = true 
)

Method which writes the results of the analysis to a file.

Parameters
sFilenameFilename with path for the results
bAsTableif true the output will have csv-format

Friends And Related Function Documentation

void Guiliani_delete ( void *  pMemory,
const char *  pFile,
int  iLine,
const char *  pFunction 
)
friend

memory-tracing function used with operator delete

Parameters
pFileFile name
iLineLine in file
pFunctionName of calling function
pMemoryPointer to allocated memory
void Guiliani_deleteArray ( void *  pMemory,
const char *  pFile,
int  iLine,
const char *  pFunction 
)
friend

memory-tracing function used with operator delete[]

Parameters
pFileFile name
iLineLine in file
pFunctionName of calling function
pMemoryPointer to allocated memory
void Guiliani_free ( void *  pMemory,
const char *  pFile,
int  iLine,
const char *  pFunction 
)
friend

memory-tracing function used with free()

Parameters
pFileFile name
iLineLine in file
pFunctionName of calling function
pMemoryPointer to allocated memory
void* Guiliani_malloc ( size_t  uiSize,
const char *  pFile,
int  iLine,
const char *  pFunction 
)
friend

memory-tracing function used with malloc()

Parameters
pFileFile name
iLineLine in file
pFunctionName of calling function
uiSizeSize
void* Guiliani_new ( size_t  uiSize,
const char *  pFile,
int  iLine,
const char *  pFunction 
)
friend

memory-tracing function used with operator new

Parameters
pFileFile name
iLineLine in file
pFunctionName of calling function
uiSizeSize
void* Guiliani_newArray ( size_t  uiSize,
const char *  pFile,
int  iLine,
const char *  pFunction 
)
friend

memory-tracing function used with operator new[]

Parameters
pFileFile name
iLineLine in file
pFunctionName of calling function
uiSizeSize
void* Guiliani_realloc ( void *  pMemory,
size_t  uiSize,
const char *  pFile,
int  iLine,
const char *  pFunction 
)
friend

memory-tracing function used with realloc()

Parameters
pFileFile name
iLineLine in file
pFunctionName of calling function
pMemoryPointer to allocated memory
uiSizeSize
void operator delete ( void *  Memory)
throw (
)
friend

delete operator

Parameters
Memory
void operator delete[] ( void *  Memory)
throw (
)
friend

delete operator[]

Parameters
Memory
void* operator new ( size_t  uiSize,
const char *  pcFile,
int  iLine,
const char *  pcFunction 
)
friend

new operator

Parameters
uiSize
pcFile
iLine
pcFunction
Returns
memory
void* operator new[] ( size_t  uiSize,
const char *  pcFile,
int  iLine,
const char *  pcFunction 
)
friend

new operator[]

Parameters
uiSize
pcFile
iLine
pcFunction
Returns
memory

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