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

CP_DefaultHeap Class Reference

Create the default heap where memory allocations come from.

Inheritance diagram for CP_DefaultHeap:

CP_Heap List of all members.

Public Member Functions

Constructor / Destructor
 CP_DefaultHeap ()
 Constructor.
virtual ~CP_DefaultHeap ()
 Destructor.
Allocate / Dealloc
void * Allocate (UInt32 inSize, bool isArray, const char *inFunction, const char *inFile, int inLine)
void Deallocate (void *inBlock, bool isArray)
Getters
SInt32 GetCurrentBytes () const
SInt32 GetHighwaterMark () const
SInt32 GetDebugOverhead () const
SInt32 GetLeakCount () const
void TurnOnDoubleDeleteDetection (bool inTurnOn=true)
bool GetDoubleDeleteDetectionStatus ()
Reporting
void DumpAllAllocations (CP_File &inFile)
void DumpSessionAllocations (CP_File &outFile, SInt16 inSessionIndex)
UInt16 CountSessionLeaks (SInt16 inSessionIndex)
void MarkAllBlocksNonLeaks ()
Validators
void ValidateBlock (const void *inPtr) const
void ValidateHeap () const
Allocate / Dealloc
void * Allocate (UInt32 inSize, bool isArray, const char *inFunction, const char *inFile, int inLine)
void Deallocate (void *inBlock, bool isArray)
Getters
SInt32 GetCurrentBytes () const
SInt32 GetHighwaterMark () const
SInt32 GetDebugOverhead () const
SInt32 GetLeakCount () const
void TurnOnDoubleDeleteDetection (bool inTurnOn=true)
bool GetDoubleDeleteDetectionStatus ()
Reporting
void DumpAllAllocations (CP_File &inFile)
void DumpSessionAllocations (CP_File &outFile, SInt16 inSessionIndex)
UInt16 CountSessionLeaks (SInt16 inSessionIndex)
void MarkAllBlocksNonLeaks ()
Validators
void ValidateBlock (const void *inPtr) const
void ValidateHeap () const

Static Public Member Functions

Instance
static CP_HeapInstance ()
operators
static void * operator new (size_t inSize)
static void operator delete (void *inPtr)
Instance
static CP_HeapInstance ()
operators
static void * operator new (size_t inSize)
static void operator delete (void *inPtr)

Static Public Attributes

static NewFunc gNewFunc = NULL
static DeleteFunc gDeleteFunc = NULL

Protected Member Functions

Recording
void AddDebugInfo (CP_S_MemoryBlock *inBlock, UInt32 inAllocSize, bool inIsArray, const char *inFunction, const char *inFile, int inLine)
Recording
void AddDebugInfo (CP_S_MemoryBlock *inBlock, UInt32 inAllocSize, bool inIsArray, const char *inFunction, const char *inFile, int inLine)

Protected Attributes

CP_S_MemoryBlockfFirstBlock
SInt32 fBlockCount
SInt32 fLeakCount
SInt32 fCurrentBytes
SInt32 fHighwaterMark
SInt32 fDebugOverhead
bool fDontDeleteBlocks

Static Protected Attributes

static CP_HeapgInstance = NULL

Constructor & Destructor Documentation

CPLAT_Begin_Namespace_CPLAT CP_DefaultHeap::CP_DefaultHeap  ) 
 

Constructor.

Exceptions:
none 

CP_DefaultHeap::~CP_DefaultHeap  )  [virtual]
 

Destructor.

Exceptions:
none 


Member Function Documentation

CP_Heap * CP_Heap::Instance  )  [static, inherited]
 

Returns the single instance of this class.

Exceptions:
none 
Returns:
CP_Heap * Returns the single instance of this class.

void * CP_Heap::Allocate UInt32  inActualBytes,
bool  isArray,
const char *  inFunction,
const char *  inFile,
int  inLine
[inherited]
 

Allocates a block of memory. If CP_Debug_RecordMemoryAllocations is defined, then extra memory recording / debugging information is added to the allocated block.

Parameters:
inActualBytes Number of bytes to allocate. This does not included the bytes needed for debugging which will be added to the number of bytes actually allocated if the flag CP_Debug_RecordMemoryAllocations is defined.
isArray Flag to indicate if this is an array, as opposed to any other type of allocation.
inFunction The function that called this method.
inFile The file where the function that called this method is.
inLine Line in the file that called this method to allocate memory.
Exceptions:
none 
Returns:
void * Returns a pointer to the 1st byte of the data memory block. This is where you will access the allocated memory, and is past any extra debugging added to the beginning of the block.

void CP_Heap::Deallocate void *  inPtr,
bool  isArray
[inherited]
 

Deallocate a block of memory.

Parameters:
inPtr Pointer to the memory block to be removed.
isArray Not used.
Exceptions:
none 
Returns:
void

SInt32 CP_Heap::GetCurrentBytes  )  const [inherited]
 

Returns the current number of bytes allocated.

Exceptions:
none 
Returns:
SInt32 Current number of allocated bytes.

SInt32 CP_Heap::GetHighwaterMark  )  const [inherited]
 

Returns the highest number of bytes allocated.

Exceptions:
none 
Returns:
SInt32 Highest number of allocated bytes.

SInt32 CP_Heap::GetDebugOverhead  )  const [inherited]
 

Returns the number of bytes used for debugging purposes.

Exceptions:
none 
Returns:
SInt32 Number of bytes used for debugging purposes.

SInt32 CP_Heap::GetLeakCount  )  const [inherited]
 

Returns the number of blocks currently marked as leaks.

Exceptions:
none 
Returns:
SInt32 Number of blocks currently marked as leaks.

void CP_Heap::TurnOnDoubleDeleteDetection bool  inTurnOn = true  )  [inherited]
 

Double delete detection. Note: When double delete detection is turn on, the allocated block is only marked as deleted, but not actually deleted from memory so memory useage may dramatically increase.

Parameters:
inTurnOn If true, turn on double delete detection.
Exceptions:
none 
Returns:
void

bool CP_Heap::GetDoubleDeleteDetectionStatus  )  [inherited]
 

Returns the state of the double delete detection flag.

Exceptions:
none 
Returns:
bool Current state of the double delete detection flag. If true, then double delete detection is on.

static void* CP_Heap::operator new size_t  inSize  )  [static, inherited]
 

void CP_Heap::operator delete void *  inPtr  )  [static, inherited]
 

Deallocate memory for this object.

Parameters:
inPtr Pointer to the block of memory to deallocate.
Exceptions:
none 
Returns:
void

void CP_Heap::DumpAllAllocations CP_File outFile  )  [inherited]
 

Dump the heap memory recording results.

Parameters:
outFile The CP_File we are writing the information to.
Exceptions:
none 
Returns:
void

void CP_Heap::DumpSessionAllocations CP_File outFile,
SInt16  inSessionIndex
[inherited]
 

Dump allocated memory blocks in the current session.

Parameters:
outFile The CP_File we are writing the information to.
inSessionIndex Index the session we are working with.
Exceptions:
none 
Returns:
void

UInt16 CP_Heap::CountSessionLeaks SInt16  inSessionIndex  )  [inherited]
 

Returns a count of the number of leaks in the passed in session index.

Parameters:
inSessionIndex Index the session to count leaks in.
Exceptions:
none 
Returns:
void

void CP_Heap::MarkAllBlocksNonLeaks  )  [inherited]
 

Mark all of our recorded blocks as non leaks.

Exceptions:
none 
Returns:
void

void CP_Heap::ValidateBlock const void *  inPtr  )  const [inherited]
 

Validate a single allocation within our heap.

Parameters:
inPtr Pointer to the block of memory to validate.
Exceptions:
none 
Returns:
void

void CP_Heap::ValidateHeap  )  const [inherited]
 

Validate the heap.

Exceptions:
none 
Returns:
void

void CP_Heap::AddDebugInfo CP_S_MemoryBlock inBlock,
UInt32  inActualBytes,
bool  isArray,
const char *  inFunction,
const char *  inFile,
int  inLine
[protected, inherited]
 

Add our debugging info to the allocated memory block.

Parameters:
inBlock The allocated memory block to add the debugging information to.
inActualBytes Number of bytes to allocate. This does not included the bytes needed for debugging which will be added to the number of bytes actually allocated if the flag CP_Debug_RecordMemoryAllocations is defined.
isArray Flag to indicate if this is an array, as opposed to any other type of allocation.
inFunction The function that called this method.
inFile The file where the function that called this method is.
inLine Line in the file that called this method to allocate memory.
Exceptions:
none 
Returns:
void


Member Data Documentation

CP_Heap * CP_Heap::gInstance = NULL [static, protected, inherited]
 

CP_S_MemoryBlock* CP_Heap::fFirstBlock [protected, inherited]
 

Points to the single instance of ourselves.

SInt32 CP_Heap::fBlockCount [protected, inherited]
 

SInt32 CP_Heap::fLeakCount [protected, inherited]
 

SInt32 CP_Heap::fCurrentBytes [protected, inherited]
 

SInt32 CP_Heap::fHighwaterMark [protected, inherited]
 

SInt32 CP_Heap::fDebugOverhead [protected, inherited]
 

bool CP_Heap::fDontDeleteBlocks [protected, inherited]
 

NewFunc CP_Heap::gNewFunc = NULL [static, inherited]
 

Flag to indicate if we delete blocks, or just mark them for double delete detection.

DeleteFunc CP_Heap::gDeleteFunc = NULL [static, inherited]
 

Pointer to the function used to allocate memory.


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