fsMemMgr is a simple memory manager that is able to address some common memory allocation problems like memory leak detection and some wrong pointer handling issues. Detailed information about memory leaks is dumped into a log file.
The memory manager can be easily integrated into a project. It consists of only 3 files: fsMemMgr.h, fsMemMgr_Not.h and fsMemMgr.cpp. The first one enables the memory manager and should be included as soon as possible (typically in a configuration header). Then all (de)allocations through the 'new' and 'delete' operators are redirected into the memory manager so that memory (de)allocations can be tracked from now.
Since the memory manager uses macros to wrap up the 'new' and 'delete' operators it is necessary to guard some code where the operators occur in another meaning than the memory (de)allocation is. For more information see fsMemMgr_Not.h
Definition in file fsMemMgr.h.
#include "fsMemMgr_NoT.h"
#include "fsMemMgr.h"
Include dependency graph for fsMemMgr.h:
Go to the source code of this file.
Namespaces | |
namespace | fs |
namespace | fs::sys |
namespace | fs::sys::mmgr |
namespace | fs::sys::mmgr::aux |
Defines | |
#define | __FUNCTION__ "???" |
#define | FS_MMGR_OWN_OPERATORS |
Defined if the internal (de)allocation operators are provided. | |
#define | new |
#define | delete |
Functions | |
void | fs::sys::mmgr::SetModNm (const char *pszModNm) |
Sets a name of the current static module (useful e.g. for multiple DLLs). | |
void | fs::sys::mmgr::aux::Track (const char *pszFunc, const char *pszFile, int nLine) |
Sets a code pos. for the last memory operation (for internal use only). | |
void * | operator new (size_t uSize) |
A monitored version of the 'new' operator. | |
void | operator delete (void *pAddr) |
A monitored version of the 'delete' operator. | |
void * | operator new[] (size_t uSize) |
A monitored version version of the 'new []' operator. | |
void | operator delete[] (void *pAddr) |
A monitored version of the 'delete []' operator. |
#define __FUNCTION__ "???" |
Definition at line 59 of file fsMemMgr.h.
#define delete |
Value:
(fs::sys::mmgr::aux::Track(__FUNCTION__, __FILE__, \ __LINE__), false) ? fs::sys::mmgr::aux::Track("", "", 0) : delete
Definition at line 93 of file fsMemMgr.h.
#define FS_MMGR_OWN_OPERATORS |
Defined if the internal (de)allocation operators are provided.
Definition at line 66 of file fsMemMgr.h.
#define new |
Value:
(fs::sys::mmgr::aux::Track(__FUNCTION__, __FILE__, \ __LINE__), false) ? 0 : new
Definition at line 83 of file fsMemMgr.h.
void operator delete | ( | void * | pAddr | ) |
A monitored version of the 'delete' operator.
void operator delete[] | ( | void * | pAddr | ) |
A monitored version of the 'delete []' operator.
void* operator new | ( | size_t | uSize | ) |
A monitored version of the 'new' operator.
void* operator new[] | ( | size_t | uSize | ) |
A monitored version version of the 'new []' operator.