CoCoALib-0.9905 date: 23 May 2007


CoCoA::MemPoolDebug Class Reference

#include <MemPool.H>

Collaboration diagram for CoCoA::MemPoolDebug:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MemPoolDebug (std::size_t sz, const std::string &name="Unnamed-MemPool", std::size_t debug_margin=ourDefaultMarginSize)
 ~MemPoolDebug ()
void * alloc ()
void * alloc (std::size_t)
void free (void *)
void free (void *, std::size_t)
void InterceptAlloc (std::size_t nth)
void InterceptFree (std::size_t nth)
void SetDebugLevel (unsigned int lev)
void SetVerbosityLevel (unsigned int lev)

Static Public Attributes

static unsigned int ourInitialVerbosityLevel
static unsigned int ourInitialDebugLevel
static unsigned int ourDefaultMarginSize
static double ourOutputStatusInterval

Private Types

typedef MemPoolFast::slice_t slice_t

Private Member Functions

 MemPoolDebug (const MemPoolDebug &)
 disallow copy construction -- never defined
MemPoolDebugoperator= (const MemPoolDebug &)
 disallow assignment -- never defined
void myAliveCheck ()
void AllocMark (slice_t p)
void FreeMark (slice_t p)
void FullOverwriteFreeCheck () const
void OverwriteErrorMesg (slice_t, void *) const
void OverwriteFreeCheck (slice_t) const
bool FreeError (void *ptr) const
void FreeErrorMesg (void *ptr, const std::string &reason) const
bool AlreadyFreed (void *ptr) const
bool WrittenOutOfRange (void *ptr) const
void PrintSlice (void *ptr) const
void DtorErrorMesg () const
void PrintStats () const
void AllocMesg (void *ptr) const
void AllocWrongSizeMesg (std::size_t sz, void *ptr) const
void FreeMesg (void *ptr) const
void FreeWrongSizeMesg (std::size_t sz, void *ptr) const
void FreeZeroPtrMesg () const
void intercepted () const

Static Private Member Functions

static std::size_t ourCheckCtorSizeArg (std::size_t sz)

Private Attributes

long myAliveOrDead
 Heuristic trick to recognise destroyed MemPools when debugging.
std::string myName
 Identifier useful during debugging.
std::size_t mySliceSizeReq
 Size in bytes originally requested in ctor.
std::size_t myMarginWords
 number of margin words before and after each block
std::size_t mySliceWords
 Size of each slice in words; 1 word = sizeof(slice_t).
std::size_t mySliceBytes
 Size actually used; always have mySliceBytes >= mySliceSizeReq.
MemPoolFast myMemMgr
 myMemMgr actually manages the alloc/free requests
slice_t myHeadOfUsedList
 Used only in the highest debug level.
unsigned int myDebugLevel
 debug level should be one of 0, 1, or 2 (>2 is same as 2)
unsigned int myVerbosityLevel
 verbosity level should be one of 0, 1, 2 or 3 (>3 is same as 3)
std::size_t myAllocCount
std::size_t myAllocWatchPoint
std::size_t myFreeCount
std::size_t myFreeWatchPoint
std::size_t myInUseCount
std::size_t myInUseMax
double myNextOutputStatusTime

Static Private Attributes

static const long AliveMark = ~0xbadc0c0a

Detailed Description

Definition at line 139 of file MemPool.H.


Member Typedef Documentation

typedef MemPoolFast::slice_t CoCoA::MemPoolDebug::slice_t [private]
 

Definition at line 166 of file MemPool.H.


Constructor & Destructor Documentation

CoCoA::MemPoolDebug::MemPoolDebug std::size_t  sz,
const std::string &  name = "Unnamed-MemPool",
std::size_t  debug_margin = ourDefaultMarginSize
 

CoCoA::MemPoolDebug::~MemPoolDebug  ) 
 

CoCoA::MemPoolDebug::MemPoolDebug const MemPoolDebug  )  [private]
 

disallow copy construction -- never defined


Member Function Documentation

void* CoCoA::MemPoolDebug::alloc  ) 
 

void* CoCoA::MemPoolDebug::alloc std::size_t   ) 
 

void CoCoA::MemPoolDebug::free void *   ) 
 

void CoCoA::MemPoolDebug::free void *  ,
std::size_t 
 

void CoCoA::MemPoolDebug::InterceptAlloc std::size_t  nth  ) 
 

void CoCoA::MemPoolDebug::InterceptFree std::size_t  nth  ) 
 

void CoCoA::MemPoolDebug::SetDebugLevel unsigned int  lev  ) 
 

void CoCoA::MemPoolDebug::SetVerbosityLevel unsigned int  lev  ) 
 

MemPoolDebug& CoCoA::MemPoolDebug::operator= const MemPoolDebug  )  [private]
 

disallow assignment -- never defined

static std::size_t CoCoA::MemPoolDebug::ourCheckCtorSizeArg std::size_t  sz  )  [static, private]
 

void CoCoA::MemPoolDebug::myAliveCheck  )  [private]
 

void CoCoA::MemPoolDebug::AllocMark slice_t  p  )  [private]
 

void CoCoA::MemPoolDebug::FreeMark slice_t  p  )  [private]
 

void CoCoA::MemPoolDebug::FullOverwriteFreeCheck  )  const [private]
 

void CoCoA::MemPoolDebug::OverwriteErrorMesg slice_t  ,
void * 
const [private]
 

void CoCoA::MemPoolDebug::OverwriteFreeCheck slice_t   )  const [private]
 

bool CoCoA::MemPoolDebug::FreeError void *  ptr  )  const [private]
 

void CoCoA::MemPoolDebug::FreeErrorMesg void *  ptr,
const std::string &  reason
const [private]
 

bool CoCoA::MemPoolDebug::AlreadyFreed void *  ptr  )  const [private]
 

bool CoCoA::MemPoolDebug::WrittenOutOfRange void *  ptr  )  const [private]
 

void CoCoA::MemPoolDebug::PrintSlice void *  ptr  )  const [private]
 

void CoCoA::MemPoolDebug::DtorErrorMesg  )  const [private]
 

void CoCoA::MemPoolDebug::PrintStats  )  const [private]
 

void CoCoA::MemPoolDebug::AllocMesg void *  ptr  )  const [private]
 

void CoCoA::MemPoolDebug::AllocWrongSizeMesg std::size_t  sz,
void *  ptr
const [private]
 

void CoCoA::MemPoolDebug::FreeMesg void *  ptr  )  const [private]
 

void CoCoA::MemPoolDebug::FreeWrongSizeMesg std::size_t  sz,
void *  ptr
const [private]
 

void CoCoA::MemPoolDebug::FreeZeroPtrMesg  )  const [private]
 

void CoCoA::MemPoolDebug::intercepted  )  const [private]
 


Member Data Documentation

unsigned int CoCoA::MemPoolDebug::ourInitialVerbosityLevel [static]
 

Definition at line 157 of file MemPool.H.

unsigned int CoCoA::MemPoolDebug::ourInitialDebugLevel [static]
 

Definition at line 158 of file MemPool.H.

unsigned int CoCoA::MemPoolDebug::ourDefaultMarginSize [static]
 

Definition at line 159 of file MemPool.H.

double CoCoA::MemPoolDebug::ourOutputStatusInterval [static]
 

Definition at line 160 of file MemPool.H.

const long CoCoA::MemPoolDebug::AliveMark = ~0xbadc0c0a [static, private]
 

Definition at line 167 of file MemPool.H.

long CoCoA::MemPoolDebug::myAliveOrDead [private]
 

Heuristic trick to recognise destroyed MemPools when debugging.

Definition at line 168 of file MemPool.H.

std::string CoCoA::MemPoolDebug::myName [private]
 

Identifier useful during debugging.

Definition at line 170 of file MemPool.H.

std::size_t CoCoA::MemPoolDebug::mySliceSizeReq [private]
 

Size in bytes originally requested in ctor.

Definition at line 171 of file MemPool.H.

std::size_t CoCoA::MemPoolDebug::myMarginWords [private]
 

number of margin words before and after each block

Definition at line 172 of file MemPool.H.

std::size_t CoCoA::MemPoolDebug::mySliceWords [private]
 

Size of each slice in words; 1 word = sizeof(slice_t).

Definition at line 173 of file MemPool.H.

std::size_t CoCoA::MemPoolDebug::mySliceBytes [private]
 

Size actually used; always have mySliceBytes >= mySliceSizeReq.

Definition at line 174 of file MemPool.H.

MemPoolFast CoCoA::MemPoolDebug::myMemMgr [private]
 

myMemMgr actually manages the alloc/free requests

Definition at line 175 of file MemPool.H.

slice_t CoCoA::MemPoolDebug::myHeadOfUsedList [private]
 

Used only in the highest debug level.

Definition at line 176 of file MemPool.H.

unsigned int CoCoA::MemPoolDebug::myDebugLevel [private]
 

debug level should be one of 0, 1, or 2 (>2 is same as 2)

Definition at line 178 of file MemPool.H.

unsigned int CoCoA::MemPoolDebug::myVerbosityLevel [private]
 

verbosity level should be one of 0, 1, 2 or 3 (>3 is same as 3)

Definition at line 179 of file MemPool.H.

std::size_t CoCoA::MemPoolDebug::myAllocCount [private]
 

Definition at line 180 of file MemPool.H.

std::size_t CoCoA::MemPoolDebug::myAllocWatchPoint [private]
 

Definition at line 181 of file MemPool.H.

std::size_t CoCoA::MemPoolDebug::myFreeCount [private]
 

Definition at line 182 of file MemPool.H.

std::size_t CoCoA::MemPoolDebug::myFreeWatchPoint [private]
 

Definition at line 183 of file MemPool.H.

std::size_t CoCoA::MemPoolDebug::myInUseCount [private]
 

Definition at line 184 of file MemPool.H.

std::size_t CoCoA::MemPoolDebug::myInUseMax [private]
 

Definition at line 185 of file MemPool.H.

double CoCoA::MemPoolDebug::myNextOutputStatusTime [private]
 

Definition at line 186 of file MemPool.H.


The documentation for this class was generated from the following file:
Generated on Wed May 23 13:44:31 2007 for CoCoALib by  doxygen 1.4.6