MemoryLeakIndicator
Loading...
Searching...
No Matches
MemSpy Namespace Reference

Classes

class  LeakMap
 Class to access forgotten objects in memory.
Inspired by Rainer Grimm and Mouaz Chamieh. More...
 
class  Trace
 Class to be able to write a TRACE output to the output window also in Releas mode.
Found in http://blog.m-ri.de/index.php/2009/08/09/vs-tippstricks-einfache-ausgabe-mit-trace-auch-in-der-release-version/ More...
 

Typedefs

typedef bool TbExceptionMode
 
typedef int TiOutput
 

Enumerations

enum  SeekMode { START , NEXT , CURRENT }
 

Functions

__mem_leak_indicator_export_dll MemSpy::LeakMapactivateMemoryMonitoring (MemSpy::TbExceptionMode bExceptionMode=MemSpy::THROW)
 
void __mem_leak_indicator_export_dll finishMemoryMonitoring (MemSpy::TiOutput iOutput=MemSpy::OUTPUT_CONSOLE)
 

Variables

const TbExceptionMode NOTHROW = false
 
const TbExceptionMode THROW = true
 
const TiOutput OUTPUT_NON = 0
 
const TiOutput OUTPUT_CONSOLE = 1
 
const TiOutput OUTPUT_TRACE = 2
 

Typedef Documentation

◆ TbExceptionMode

Type to tell the MemSpy::activateMemoryMonitoring (...) function whether an exception is thrown on error, or just a 0 as return value.

◆ TiOutput

typedef int MemSpy::TiOutput

Type to tell the MemSpy::finishMemoryMonitoring (...) function whether to output to the console.

Enumeration Type Documentation

◆ SeekMode

To iterate through LeakMap::m_ObjectList.

Enumerator
START 

The first element is meant.

NEXT 

The next element after the current element is meant.

CURRENT 

The current element is meant.

Function Documentation

◆ activateMemoryMonitoring()

__mem_leak_indicator_export_dll MemSpy::LeakMap * MemSpy::activateMemoryMonitoring ( MemSpy::TbExceptionMode bExceptionMode = MemSpy::THROW)

Enables storage monitoring and instantiates the LeakMap.
This function should be called in the main at the beginning before instantiating objects.

Parameters
[in]bExceptionModeSee MemSpy::NoThrow and MemSpy::Throw.
Returns
If bExceptionMode == MemSpy::NOTHROW, a NULL_PTR is returned on error, otherwise a pointer to the MemSpy::LeakMap.
Exceptions
Ifthis function is called again, a std::range_error is thrown if bExceptionMode == MemSpy::THROW.
Attention
If a pointer to the MemSpy::LeakMap is supplied, the MemSpy::LeakMap must not be removed from memory by the calling instance.
This may only be initiated with MemSpy::finishMemoryMonitoring (...), MemSpy::LeakMap::destroy() or MemSpy::LeakMap::destroyAbsolutely().

◆ finishMemoryMonitoring()

void __mem_leak_indicator_export_dll MemSpy::finishMemoryMonitoring ( MemSpy::TiOutput iOutput = MemSpy::OUTPUT_CONSOLE)

Stops memory monitoring and removes the LeakMap from memory.
This function should be called in main at the end after object instantiation, so that information about memory leaks can be output if necessary.

Parameters
[in]iOutputSee MemSpy::OUTPUT_NON and MemSpy::OUTPUT_CONSOLE.

Variable Documentation

◆ NOTHROW

const TbExceptionMode MemSpy::NOTHROW = false

Function MemSpy::activateMemoryMonitoring (...) returns a 0 as return value in case of an error.

◆ OUTPUT_CONSOLE

const TiOutput MemSpy::OUTPUT_CONSOLE = 1

Function MemSpy::finishMemoryMonitoring (...) outputs its information to the console.

◆ OUTPUT_NON

const TiOutput MemSpy::OUTPUT_NON = 0

Function MemSpy::finishMemoryMonitoring (...) does not output anything. This can be useful if an output is to be printed to a GUI window.

◆ OUTPUT_TRACE

const TiOutput MemSpy::OUTPUT_TRACE = 2

Function MemSpy::finishMemoryMonitoring (...) outputs its information iin the output window.

◆ THROW

const TbExceptionMode MemSpy::THROW = true

Function MemSpy::activateMemoryMonitoring (...) throws a std::range_error on error.