Table of Contents

Tracking

Description

tTracking.h Provides simple automatic memory leak tracking and memory sentinels. This functionality is enabled for debug and partial builds only, as it should not be required for final builds. Tracked memory is stored in an STL set, which has O(log n) search time, so any speed hit from memory tracking should be (typically) very small and unnoticeable.

Methods

void *operator new(size_t size, char *F, tUInt32 L);   //single allocation
void *operator new[](size_t size, char *F, tUInt32 L); //array allocation
 
void operator delete(void *ptr);   //single deletion
void operator delete[](void *ptr); //array deletion
 
//Helper macro
#define new new(__FILE__, __LINE__)

These methods provide the exact functionality of C++ new and delete, with some additions:

All of this helps to ensure code stability and helps prevent against tiny memory errors that can potentially snowball out of control.

Even though there is improved functionality, there are a few things worth mentioning, see the notes below for more details.

Notes