Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CP_MemoryTracker Class Reference

List of all members.

Public Member Functions

Constructor / Destructor
 CP_MemoryTracker ()
 Constructor.
virtual ~CP_MemoryTracker ()
 Destructor.
Recording
void StartRecording ()
void StopRecording ()
bool IsRecording ()
void RecordAllocation (E_CP_BlockType inBlockType, void *inMemoryBlocksAddress, SInt32 inBlockSize, const char *inFunction, const char *inFile, SInt16 inLine)
void RecordDeallocation (void *inMemoryBlocksAddress, bool inDoubleDeleteDetection=false)
void DumpTrackingResults ()
void DumpCurrentSessionTrackingResults (char *inFileName)
void DumpSessionTrackingResults (char *inFileName, SInt16 inSession)
void DumpSessionTrackingResults (const CP_FileSystemSpec &inFileSpec, SInt16 inSession)
void MarkAllBlocksStatus (SInt32 inBlockStatus)
void MarkAllBlocksNonLeaks ()
Sessions
void BeginSession (char *inSessionName)
void EndSession ()
void EndSession (const CP_FileSystemSpec &inFileSpec)
SInt32 GetCurrentSession ()
CP_String GetCurrentSessionName () const
CP_Session_ListGetSessionsList ()
SInt16 GetDebugStackCrawlDepth ()
void SetDebugStackCrawlDepth (SInt16 inDepth)

Static Public Member Functions

Instance
static CP_MemoryTrackerInstance ()
operators
static void * operator new (size_t size)
static void operator delete (void *ptr)

Protected Attributes

bool fAllowRecording
CP_Resource_List fAllocatedResources
CP_Session_List fSessionsList
SInt32 fCurrentSession
SInt16 fDebugStackCrawlDepth

Static Protected Attributes

static CP_MemoryTrackergInstance = NULL

Private Member Functions

Recording
void DumpAllAllocations (CP_File &outFile)
SInt32 CountLeaks ()
Sessions
void DumpSessionAllocations (CP_File &outFile, SInt32 inSessionIndex)
UInt32 CountSessionAllocations (SInt32 inSessionIndex)

Constructor & Destructor Documentation

CP_MemoryTracker::CP_MemoryTracker  ) 
 

Constructor.

Exceptions:
none 

CP_MemoryTracker::~CP_MemoryTracker  )  [virtual]
 

Destructor.

Exceptions:
none 


Member Function Documentation

CP_MemoryTracker * CP_MemoryTracker::Instance  )  [static]
 

Create our memory heap for objects and returns a pointer to the single instance of this object.

Exceptions:
none 
Returns:
CP_MemoryTracker * The single instance of this class.

void CP_MemoryTracker::StartRecording  ) 
 

Turns memory recording on.

Exceptions:
none 
Returns:
void

void CP_MemoryTracker::StopRecording  ) 
 

Turns memory recording off.

Exceptions:
none 
Returns:
void

bool CP_MemoryTracker::IsRecording  ) 
 

Returns true if memory recording is currently turned on.

Exceptions:
none 
Returns:
bool True if memory recording is currently on.

void CP_MemoryTracker::RecordAllocation E_CP_BlockType  inBlockType,
void *  inMemoryBlocksAddress,
SInt32  inBlockSize,
const char *  inFunction,
const char *  inFile,
SInt16  inLine
 

Add a new memory allocation to our list of recorded memory blocks.

Parameters:
inBlockType The type of memory block being recorded:
  • BT_Handle,
  • BT_Ptr,
  • BT_PtrToHand,
  • BT_HandToHand,
  • BT_Resource,
  • BT_ColorTable,
  • BT_GWorld,
  • BT_Menu,
  • BT_MenuBar,
  • BT_Picture,
  • BT_PixMap,
  • BT_Region,
  • BT_Window,
  • BT_AppleEvent,
  • BT_CoreFoundation,
  • BT_Win_Bitmap,
  • BT_Win_Brush,
  • BT_Win_DC,
  • BT_Win_Font,
  • BT_Win_GDIShape,
  • BT_Win_Palette,
  • BT_Win_Pen,
  • BT_Win_Memory
inMemoryBlocksAddress Address of the memory block being allocated.
inBlockSize Size of the memory block.
inFunction Function that allocated the memory block.
inFile File that is contains the function allocating the memory.
inLine Line in the file that is allocating the memory.
Exceptions:
none 
Returns:
void

void CP_MemoryTracker::RecordDeallocation void *  inMemoryBlocksAddress,
bool  inDoubleDeleteDetection = false
 

Remove a memory allocation record for the passed in address.

Parameters:
inMemoryBlocksAddress Address of the memory block.
inDoubleDeleteDetection Flag to indicate if the memory should be freed or just marked as freed to detect a double delete.
Exceptions:
none 
Returns:
void

void CP_MemoryTracker::DumpTrackingResults  ) 
 

Dump sessions to file from startSession to endSession.

Exceptions:
none 
Returns:
void

void CP_MemoryTracker::DumpCurrentSessionTrackingResults char *  inFileName  ) 
 

void CP_MemoryTracker::DumpSessionTrackingResults char *  inFileName,
SInt16  inSession
 

void CP_MemoryTracker::DumpSessionTrackingResults const CP_FileSystemSpec inFileSpec,
SInt16  inSession
 

void CP_MemoryTracker::MarkAllBlocksStatus SInt32  inBlockStatus  ) 
 

void CP_MemoryTracker::MarkAllBlocksNonLeaks  ) 
 

void * CP_MemoryTracker::operator new size_t  size  )  [static]
 

void CP_MemoryTracker::operator delete void *  ptr  )  [static]
 

void CP_MemoryTracker::BeginSession char *  inSessionName  ) 
 

void CP_MemoryTracker::EndSession  ) 
 

void CP_MemoryTracker::EndSession const CP_FileSystemSpec inFileSpec  ) 
 

SInt32 CP_MemoryTracker::GetCurrentSession  ) 
 

Returns the index of the current session in the list of sessions.

Exceptions:
none 
Returns:
SInt32 The current session index.

CP_String CP_MemoryTracker::GetCurrentSessionName  )  const
 

CP_Session_List* CP_MemoryTracker::GetSessionsList  ) 
 

Returns the list of sessions.

Exceptions:
none 
Returns:
CP_Session_List List of memory recording sessions.

SInt16 CP_MemoryTracker::GetDebugStackCrawlDepth  ) 
 

Returns the size of the debug stack recorded with each allocation.

Exceptions:
none 
Returns:
SInt16 Size of the debug stack.

void CP_MemoryTracker::SetDebugStackCrawlDepth SInt16  inDepth  ) 
 

Sets the size of the debug stack recorded with each allocation.

Parameters:
inDepth Size of the debug stack to use with each memory recording.
Exceptions:
none 
Returns:
void

void CP_MemoryTracker::DumpAllAllocations CP_File outFile  )  [private]
 

Dump sessions to file from startSession to endSession.

Parameters:
outFile The file to write the allocations to.
Exceptions:
none 
Returns:
void

SInt32 CP_MemoryTracker::CountLeaks  )  [private]
 

void CP_MemoryTracker::DumpSessionAllocations CP_File outFile,
SInt32  inSessionIndex
[private]
 

UInt32 CP_MemoryTracker::CountSessionAllocations SInt32  inSessionIndex  )  [private]
 


Member Data Documentation

CPLAT_Begin_Namespace_CPLAT CP_MemoryTracker * CP_MemoryTracker::gInstance = NULL [static, protected]
 

Pointer to ourselves.

bool CP_MemoryTracker::fAllowRecording [protected]
 

Used to temporarlly turn recording off.

CP_Resource_List CP_MemoryTracker::fAllocatedResources [protected]
 

List of allocated resources.

CP_Session_List CP_MemoryTracker::fSessionsList [protected]
 

List of sessions.

SInt32 CP_MemoryTracker::fCurrentSession [protected]
 

Current recording session.

SInt16 CP_MemoryTracker::fDebugStackCrawlDepth [protected]
 

Length of our stack crawl in memory recordings.


The documentation for this class was generated from the following files:
Generated on Sat Sep 17 20:01:52 2005 for CPLAT by  doxygen 1.4.0