# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NLMISC::CHeapAllocator Class Reference

#include <heap_allocator.h>

List of all members.

Public Types

typedef char TCategoryString [CategoryStringLength]
enum  {
  ReleaseHeaderSize = 8, CategoryStringLength = 8, BeginNodeMarkers = '<', EndNodeMarkers = '>',
  UnallocatedMemory = 0xba, UninitializedMemory = 0xbc, DeletedMemory = 0xbd, NameLength = 32
}
enum  TBlockAllocationMode { Grow, DontGrow }
 Block allocation mode. More...

enum  TOutOfMemoryMode { ThrowException, ReturnNull }
 Out of memory signal. More...

enum  {
  SmallBlockGranularityShift = 3, SmallBlockGranularity = 1<<SmallBlockGranularityShift, FirstSmallBlock = 8, LastSmallBlock = 128,
  SmallBlockPoolSize = 20
}

Public Methods

 CHeapAllocator (uint mainBlockSize=1024 *1024 *10, uint blockCount=1, TBlockAllocationMode blockAllocationMode=Grow, TOutOfMemoryMode outOfMemoryMode=ThrowException)
virtual ~CHeapAllocator ()
void * allocate (uint size, const char *sourceFile, uint line, const char *category)
void * reallocate (void *ptr, uint size, const char *sourceFile, uint line, const char *category)
void free (void *ptr)
void freeAll ()
void releaseMemory ()
bool setMainBlockSize (uint mainBlockSize)
uint getMainBlockSize () const
bool setMainBlockCount (uint blockCount)
uint getMainBlockCount () const
void setBlockAllocationMode (TBlockAllocationMode mode)
TBlockAllocationMode getBlockAllocationMode () const
void setOutOfMemoryMode (TOutOfMemoryMode mode)
TOutOfMemoryMode getOutOfMemoryMode () const
bool checkHeap (bool stopOnError) const
uint getAllocatedMemory () const
uint getFreeMemory () const
uint getTotalMemoryUsed () const
uint getSmallBlockMemory () const
uint getAllocatedSystemMemoryByAllocator ()
float getFragmentationRatio () const
void setName (const char *name)
const char * getName () const
uint debugGetDebugInfoSize () const
uint debugGetSBDebugInfoSize () const
uint debugGetLBDebugInfoSize () const
uint debugGetAllocatedMemoryByCategory (const char *category) const
bool debugStatisticsReport (const char *stateFile, bool memoryMap)
void debugAlwaysCheckMemory (bool alwaysCheck)
bool debugIsAlwaysCheckMemory (bool alwaysCheck) const
void debugReportMemoryLeak ()
virtual uint8allocateBlock (uint size)
virtual void freeBlock (uint8 *block)
void debugPushCategoryString (const char *str)
void debugPopCategoryString ()

Static Public Methods

uint getBlockSize (void *block)
uint getAllocatedSystemMemory ()

Private Types

enum  { FreeNodeBlockSize = 128, FreeNodeBlockSizeShift = 7, FreeNodeBlockSizeMask = 0x7f }
enum  { Align = 8, BlockDataSizeMin = 1<<4 }
enum  { UserDataBlockSizeMin = sizeof(CFreeNode) }

Private Methods

bool checkNodeLB (const CMainBlock *mainBlock, const CNodeBegin *previous, const CNodeBegin *current, const CNodeBegin *next, bool stopOnError) const
void rotateLeft (CFreeNode *x)
void rotateRight (CFreeNode *x)
void insert (CFreeNode *x)
void erase (CFreeNode *z)
CFreeNodefind (uint size)
CNodeBeginsplitNode (CNodeBegin *node, uint newSize)
void initEmptyBlock (CMainBlock &mainBlock)
bool checkFreeNode (const CFreeNode *current, bool stopOnError, bool recurse) const
void checkNode (const CNodeBegin *current, uint32 crc) const
bool internalCheckHeap (bool stopOnError) const
void enterCriticalSection () const
void leaveCriticalSection () const
void enterCriticalSectionSB () const
void leaveCriticalSectionSB () const
void enterCriticalSectionLB () const
void leaveCriticalSectionLB () const
bool checkNodeSB (const CSmallBlockPool *mainBlock, const CNodeBegin *previous, const CNodeBegin *current, const CNodeBegin *next, bool stopOnError) const

Static Private Methods

uint32 evalMagicNumber (const CNodeBegin *node)
const CNodeBegingetNextNode (const CNodeBegin *current)
CNodeBegingetNextNode (CNodeBegin *current)
const CFreeNodegetFreeNode (const CNodeBegin *current)
CFreeNodegetFreeNode (CNodeBegin *current)
const CNodeBegingetNode (const CFreeNode *current)
CNodeBegingetNode (CFreeNode *current)
uint getNodeSize (const CNodeBegin *current)
bool isNodeFree (const CNodeBegin *current)
bool isNodeUsed (const CNodeBegin *current)
bool isNodeLast (const CNodeBegin *current)
bool isNodeSmall (const CNodeBegin *current)
bool isNodeRed (const CFreeNode *current)
bool isNodeBlack (const CFreeNode *current)
void setNodeFree (CNodeBegin *current)
void setNodeUsed (CNodeBegin *current)
void setNodeLast (CNodeBegin *current, bool last)
void setNodeSize (CNodeBegin *current, uint size)
void setNodeColor (CFreeNode *current, bool red)
void setNodeRed (CFreeNode *current)
void setNodeBlack (CFreeNode *current)
const CNodeBegingetFirstNode (const CMainBlock *mainBlock)
CNodeBegingetFirstNode (CMainBlock *mainBlock)
void mergeNode (CNodeBegin *node)
void computeCRC32 (uint32 &crc, const void *buffer, unsigned int count)
CNodeBegingetSmallBlock (CSmallBlockPool *smallBlock, uint blockIndex)
CNodeBegingetNextSmallBlock (CNodeBegin *previous)
void setNextSmallBlock (CNodeBegin *previous, CNodeBegin *next)

Private Attributes

uint _MainBlockSize
uint _BlockCount
TBlockAllocationMode _BlockAllocationMode
TOutOfMemoryMode _OutOfMemoryMode
bool _AlwaysCheck
CMainBlock_MainBlockList
CFreeNode_FreeTreeRoot
CNullNode _NullNode
CAllocatorMutex _MutexLB
char _Name [NameLength]
uint32 _AllocateCount
volatile CNodeBegin_FreeSmallBlocks [NL_SMALLBLOCK_COUNT]
volatile CSmallBlockPool_SmallBlockPool
CAllocatorMutex _MutexSB
CTDS _CategoryStack


Member Typedef Documentation

typedef char NLMISC::CHeapAllocator::TCategoryString[CategoryStringLength]
 

Definition at line 106 of file include/nel/misc/heap_allocator.h.


Member Enumeration Documentation

anonymous enum [private]
 

Enumeration values:
Align 
BlockDataSizeMin 

Definition at line 213 of file include/nel/misc/heap_allocator.h.

anonymous enum [private]
 

Enumeration values:
UserDataBlockSizeMin 

Definition at line 330 of file include/nel/misc/heap_allocator.h.

anonymous enum
 

Enumeration values:
SmallBlockGranularityShift 
SmallBlockGranularity 
FirstSmallBlock 
LastSmallBlock 
SmallBlockPoolSize 

Definition at line 403 of file include/nel/misc/heap_allocator.h.

anonymous enum
 

Enumeration values:
ReleaseHeaderSize 
CategoryStringLength 
BeginNodeMarkers 
EndNodeMarkers 
UnallocatedMemory 
UninitializedMemory 
DeletedMemory 
NameLength 

Definition at line 70 of file include/nel/misc/heap_allocator.h.

anonymous enum [private]
 

Enumeration values:
FreeNodeBlockSize 
FreeNodeBlockSizeShift 
FreeNodeBlockSizeMask 

Definition at line 205 of file include/nel/misc/heap_allocator.h.

enum NLMISC::CHeapAllocator::TBlockAllocationMode
 

Block allocation mode.

Enumeration values:
Grow  When the allocator runs out of memory, allocate a new block.
DontGrow  When the allocator runs out of memory, returns a out of memory signal.

Definition at line 85 of file include/nel/misc/heap_allocator.h.

enum NLMISC::CHeapAllocator::TOutOfMemoryMode
 

Out of memory signal.

Enumeration values:
ThrowException  When the allocator runs out of memory, throw an exception.
ReturnNull  When the allocator runs out of memory, returns NULL.

Definition at line 97 of file include/nel/misc/heap_allocator.h.


Constructor & Destructor Documentation

NLMISC::CHeapAllocator::CHeapAllocator uint    mainBlockSize = 1024 *1024 *10,
uint    blockCount = 1,
TBlockAllocationMode    blockAllocationMode = Grow,
TOutOfMemoryMode    outOfMemoryMode = ThrowException
 

Definition at line 70 of file misc/heap_allocator.cpp.

References _AllocateCount, _AlwaysCheck, _BlockAllocationMode, _BlockCount, _FreeSmallBlocks, _FreeTreeRoot, _MainBlockList, _MainBlockSize, _Name, _NullNode, _OutOfMemoryMode, _SmallBlockPool, Align, enterCriticalSection, FirstSmallBlock, NLMISC::CHeapAllocator::CNullNode::FreeNode, internalAssert, LastSmallBlock, leaveCriticalSection, NLMISC::CHeapAllocator::CFreeNode::Left, NLMISC::CHeapAllocator::CFreeNode::Parent, NLMISC::CHeapAllocator::CFreeNode::Right, setNodeBlack, and SmallBlockGranularity.

NLMISC::CHeapAllocator::~CHeapAllocator   [virtual]
 

Definition at line 128 of file misc/heap_allocator.cpp.

References releaseMemory.


Member Function Documentation

void * NLMISC::CHeapAllocator::allocate uint    size,
const char *    sourceFile,
uint    line,
const char *    category
 

Definition at line 643 of file misc/heap_allocator.cpp.

References internalAssert, NelAlloc, NL_ALIGN_SIZE_FOR_SMALLBLOCK, NL_HEAP_SB_CATEGORY, NL_HEAP_UNKNOWN_CATEGORY, NL_SIZE_TO_SMALLBLOCK_INDEX, and NL_UPDATE_MAGIC_NUMBER.

uint8 * NLMISC::CHeapAllocator::allocateBlock uint    size [virtual]
 

Definition at line 2053 of file misc/heap_allocator.cpp.

bool NLMISC::CHeapAllocator::checkFreeNode const CFreeNode   current,
bool    stopOnError,
bool    recurse
const [private]
 

Referenced by internalCheckHeap.

bool NLMISC::CHeapAllocator::checkHeap bool    stopOnError const
 

Definition at line 2044 of file misc/heap_allocator.cpp.

References internalCheckHeap, and res.

void NLMISC::CHeapAllocator::checkNode const CNodeBegin   current,
uint32    crc
const [private]
 

Definition at line 2208 of file misc/heap_allocator.cpp.

Referenced by debugReportMemoryLeak, free, getAllocatedMemory, and getFreeMemory.

bool NLMISC::CHeapAllocator::checkNodeLB const CMainBlock   mainBlock,
const CNodeBegin   previous,
const CNodeBegin   current,
const CNodeBegin   next,
bool    stopOnError
const [private]
 

Referenced by internalCheckHeap.

bool NLMISC::CHeapAllocator::checkNodeSB const CSmallBlockPool   mainBlock,
const CNodeBegin   previous,
const CNodeBegin   current,
const CNodeBegin   next,
bool    stopOnError
const [private]
 

Referenced by internalCheckHeap.

void NLMISC::CHeapAllocator::computeCRC32 uint32   crc,
const void *    buffer,
unsigned int    count
[inline, static, private]
 

void NLMISC::CHeapAllocator::debugAlwaysCheckMemory bool    alwaysCheck
 

Definition at line 2137 of file misc/heap_allocator.cpp.

References _AlwaysCheck.

uint NLMISC::CHeapAllocator::debugGetAllocatedMemoryByCategory const char *    category const
 

Definition at line 1239 of file misc/heap_allocator.cpp.

References _MainBlockList, _SmallBlockPool, enterCriticalSection, getFirstNode, getNextNode, getNodeSize, getSmallBlock, isNodeUsed, leaveCriticalSection, and SmallBlockPoolSize.

uint NLMISC::CHeapAllocator::debugGetDebugInfoSize   const
 

Definition at line 1298 of file misc/heap_allocator.cpp.

References debugGetLBDebugInfoSize, and debugGetSBDebugInfoSize.

Referenced by debugStatisticsReport.

uint NLMISC::CHeapAllocator::debugGetLBDebugInfoSize   const
 

Definition at line 1304 of file misc/heap_allocator.cpp.

References _MainBlockList, enterCriticalSection, getFirstNode, getNextNode, leaveCriticalSection, and ReleaseHeaderSize.

Referenced by debugGetDebugInfoSize, and debugStatisticsReport.

uint NLMISC::CHeapAllocator::debugGetSBDebugInfoSize   const
 

Definition at line 1336 of file misc/heap_allocator.cpp.

References _SmallBlockPool, enterCriticalSection, leaveCriticalSection, ReleaseHeaderSize, and SmallBlockPoolSize.

Referenced by debugGetDebugInfoSize, and debugStatisticsReport.

bool NLMISC::CHeapAllocator::debugIsAlwaysCheckMemory bool    alwaysCheck const
 

Definition at line 2146 of file misc/heap_allocator.cpp.

References _AlwaysCheck.

void NLMISC::CHeapAllocator::debugPopCategoryString  
 

Definition at line 2183 of file misc/heap_allocator.cpp.

References _CategoryStack, and free.

Referenced by debugReportMemoryLeak, and debugStatisticsReport.

void NLMISC::CHeapAllocator::debugPushCategoryString const char *    str
 

Definition at line 2167 of file misc/heap_allocator.cpp.

References _CategoryStack, NelAlloc, and NL_HEAP_CATEGORY_BLOCK_CATEGORY.

Referenced by debugReportMemoryLeak, and debugStatisticsReport.

void NLMISC::CHeapAllocator::debugReportMemoryLeak  
 

Definition at line 1910 of file misc/heap_allocator.cpp.

References _MainBlockList, _Name, _SmallBlockPool, NLMISC::CHeapAllocatorOutputError, checkNode, debugPopCategoryString, debugPushCategoryString, evalMagicNumber, getFirstNode, getNextNode, getNodeSize, getSmallBlock, isNodeUsed, NL_HEAP_MEM_DEBUG_CATEGORY, SmallBlockPoolSize, NLMISC::smprintf, and NLMISC::TLinkMap.

bool NLMISC::CHeapAllocator::debugStatisticsReport const char *    stateFile,
bool    memoryMap
 

Definition at line 1387 of file misc/heap_allocator.cpp.

References _MainBlockList, _Name, _SmallBlockPool, debugGetDebugInfoSize, debugGetLBDebugInfoSize, debugGetSBDebugInfoSize, debugPopCategoryString, debugPushCategoryString, file, free, getAllocatedMemory, getAllocatedSystemMemory, getAllocatedSystemMemoryByAllocator, getFirstNode, getFragmentationRatio, getFreeMemory, getMainBlockCount, getMainBlockSize, getNextNode, getNodeSize, getSmallBlock, getSmallBlockMemory, getTotalMemoryUsed, index, isNodeFree, isNodeUsed, NL_HEAP_MEM_DEBUG_CATEGORY, NL_SIZE_TO_SMALLBLOCK_INDEX, ReleaseHeaderSize, SmallBlockGranularity, and SmallBlockPoolSize.

void NLMISC::CHeapAllocator::enterCriticalSection   const [private]
 

Referenced by CHeapAllocator, debugGetAllocatedMemoryByCategory, debugGetLBDebugInfoSize, debugGetSBDebugInfoSize, freeAll, getAllocatedMemory, getFragmentationRatio, getFreeMemory, getSmallBlockMemory, getTotalMemoryUsed, internalCheckHeap, releaseMemory, and setName.

void NLMISC::CHeapAllocator::enterCriticalSectionLB   const [private]
 

Referenced by free.

void NLMISC::CHeapAllocator::enterCriticalSectionSB   const [private]
 

Referenced by free.

void NLMISC::CHeapAllocator::erase CFreeNode   z [inline, private]
 

Definition at line 259 of file misc/heap_allocator.cpp.

References _FreeTreeRoot, _NullNode, NLMISC::CHeapAllocator::CNullNode::FreeNode, internalAssert, isNodeBlack, isNodeRed, NL_UPDATE_MAGIC_NUMBER_FREE_NODE, rotateLeft, rotateRight, setNodeBlack, setNodeColor, setNodeRed, w, x, y, and z.

Referenced by free.

uint32 NLMISC::CHeapAllocator::evalMagicNumber const CNodeBegin   node [static, private]
 

Referenced by debugReportMemoryLeak, free, getAllocatedMemory, and getFreeMemory.

CFreeNode* NLMISC::CHeapAllocator::find uint    size [inline, private]
 

void NLMISC::CHeapAllocator::free void *    ptr
 

Definition at line 988 of file misc/heap_allocator.cpp.

References _FreeSmallBlocks, checkNode, DeletedMemory, enterCriticalSectionLB, enterCriticalSectionSB, erase, evalMagicNumber, getFreeNode, getNextNode, getNodeSize, insert, internalCheckHeap, isNodeFree, LastSmallBlock, leaveCriticalSectionLB, leaveCriticalSectionSB, mergeNode, NL_SIZE_TO_SMALLBLOCK_INDEX, NL_UPDATE_MAGIC_NUMBER, and setNodeFree.

Referenced by debugPopCategoryString, debugStatisticsReport, and getFragmentationRatio.

void NLMISC::CHeapAllocator::freeAll  
 

Definition at line 1839 of file misc/heap_allocator.cpp.

References _FreeTreeRoot, _MainBlockList, _NullNode, enterCriticalSection, NLMISC::CHeapAllocator::CNullNode::FreeNode, getFirstNode, getFreeNode, initEmptyBlock, insert, leaveCriticalSection, and NL_UPDATE_MAGIC_NUMBER.

void NLMISC::CHeapAllocator::freeBlock uint8   block [virtual]
 

Definition at line 2061 of file misc/heap_allocator.cpp.

Referenced by releaseMemory.

uint NLMISC::CHeapAllocator::getAllocatedMemory   const
 

Definition at line 1178 of file misc/heap_allocator.cpp.

References _MainBlockList, _SmallBlockPool, checkNode, enterCriticalSection, evalMagicNumber, getFirstNode, getNextNode, getNodeSize, getSmallBlock, isNodeUsed, leaveCriticalSection, NL_HEAP_SB_CATEGORY, ReleaseHeaderSize, and SmallBlockPoolSize.

Referenced by debugStatisticsReport.

uint NLMISC::CHeapAllocator::getAllocatedSystemMemory   [static]
 

Definition at line 2263 of file misc/heap_allocator.cpp.

References NLMISC::skipToken, and NLMISC::skipWS.

Referenced by debugStatisticsReport.

uint NLMISC::CHeapAllocator::getAllocatedSystemMemoryByAllocator  
 

Definition at line 2329 of file misc/heap_allocator.cpp.

References _MainBlockList.

Referenced by debugStatisticsReport.

TBlockAllocationMode NLMISC::CHeapAllocator::getBlockAllocationMode   const
 

uint NLMISC::CHeapAllocator::getBlockSize void *    block [static]
 

Definition at line 630 of file misc/heap_allocator.cpp.

References getNodeSize.

CNodeBegin* NLMISC::CHeapAllocator::getFirstNode CMainBlock   mainBlock [static, private]
 

const CNodeBegin* NLMISC::CHeapAllocator::getFirstNode const CMainBlock   mainBlock [static, private]
 

Referenced by debugGetAllocatedMemoryByCategory, debugGetLBDebugInfoSize, debugReportMemoryLeak, debugStatisticsReport, freeAll, getAllocatedMemory, getFragmentationRatio, getFreeMemory, initEmptyBlock, and internalCheckHeap.

float NLMISC::CHeapAllocator::getFragmentationRatio   const
 

Definition at line 1798 of file misc/heap_allocator.cpp.

References _MainBlockList, enterCriticalSection, free, getFirstNode, getNextNode, isNodeUsed, and leaveCriticalSection.

Referenced by debugStatisticsReport.

uint NLMISC::CHeapAllocator::getFreeMemory   const
 

Definition at line 1679 of file misc/heap_allocator.cpp.

References _MainBlockList, _SmallBlockPool, checkNode, enterCriticalSection, evalMagicNumber, getFirstNode, getNextNode, getNodeSize, getSmallBlock, isNodeFree, leaveCriticalSection, ReleaseHeaderSize, and SmallBlockPoolSize.

Referenced by debugStatisticsReport.

CFreeNode* NLMISC::CHeapAllocator::getFreeNode CNodeBegin   current [static, private]
 

const CFreeNode* NLMISC::CHeapAllocator::getFreeNode const CNodeBegin   current [static, private]
 

Referenced by free, and freeAll.

uint NLMISC::CHeapAllocator::getMainBlockCount   const
 

Referenced by debugStatisticsReport.

uint NLMISC::CHeapAllocator::getMainBlockSize   const
 

Referenced by debugStatisticsReport.

const char* NLMISC::CHeapAllocator::getName   const
 

CNodeBegin* NLMISC::CHeapAllocator::getNextNode CNodeBegin   current [static, private]
 

const CNodeBegin* NLMISC::CHeapAllocator::getNextNode const CNodeBegin   current [static, private]
 

Referenced by debugGetAllocatedMemoryByCategory, debugGetLBDebugInfoSize, debugReportMemoryLeak, debugStatisticsReport, free, getAllocatedMemory, getFragmentationRatio, getFreeMemory, internalCheckHeap, mergeNode, and splitNode.

CNodeBegin* NLMISC::CHeapAllocator::getNextSmallBlock CNodeBegin   previous [static, private]
 

CNodeBegin* NLMISC::CHeapAllocator::getNode CFreeNode   current [static, private]
 

const CNodeBegin* NLMISC::CHeapAllocator::getNode const CFreeNode   current [static, private]
 

Referenced by insert.

uint NLMISC::CHeapAllocator::getNodeSize const CNodeBegin   current [static, private]
 

Referenced by debugGetAllocatedMemoryByCategory, debugReportMemoryLeak, debugStatisticsReport, free, getAllocatedMemory, getBlockSize, getFreeMemory, initEmptyBlock, insert, mergeNode, and splitNode.

TOutOfMemoryMode NLMISC::CHeapAllocator::getOutOfMemoryMode   const
 

CNodeBegin* NLMISC::CHeapAllocator::getSmallBlock CSmallBlockPool   smallBlock,
uint    blockIndex
[static, private]
 

Referenced by debugGetAllocatedMemoryByCategory, debugReportMemoryLeak, debugStatisticsReport, getAllocatedMemory, getFreeMemory, and internalCheckHeap.

uint NLMISC::CHeapAllocator::getSmallBlockMemory   const
 

Definition at line 1771 of file misc/heap_allocator.cpp.

References _SmallBlockPool, enterCriticalSection, leaveCriticalSection, and SmallBlockPoolSize.

Referenced by debugStatisticsReport.

uint NLMISC::CHeapAllocator::getTotalMemoryUsed   const
 

Definition at line 1742 of file misc/heap_allocator.cpp.

References _MainBlockList, enterCriticalSection, leaveCriticalSection, and NLMISC::CHeapAllocator::CMainBlock::Size.

Referenced by debugStatisticsReport.

void NLMISC::CHeapAllocator::initEmptyBlock CMainBlock   mainBlock [inline, private]
 

Definition at line 575 of file misc/heap_allocator.cpp.

References BeginNodeMarkers, CategoryStringLength, EndNodeMarkers, getFirstNode, getNodeSize, internalAssert, NL_UPDATE_MAGIC_NUMBER, setNodeFree, setNodeLast, setNodeSize, and UnallocatedMemory.

Referenced by freeAll.

void NLMISC::CHeapAllocator::insert CFreeNode   x [inline, private]
 

Definition at line 136 of file misc/heap_allocator.cpp.

References _FreeTreeRoot, _NullNode, NLMISC::CHeapAllocator::CNullNode::FreeNode, getNode, getNodeSize, isNodeRed, NLMISC::CHeapAllocator::CFreeNode::Left, NL_UPDATE_MAGIC_NUMBER_FREE_NODE, NLMISC::CHeapAllocator::CFreeNode::Right, rotateLeft, rotateRight, setNodeBlack, setNodeRed, x, and y.

Referenced by free, and freeAll.

bool NLMISC::CHeapAllocator::internalCheckHeap bool    stopOnError const [private]
 

Definition at line 2068 of file misc/heap_allocator.cpp.

References _FreeTreeRoot, _MainBlockList, _SmallBlockPool, checkFreeNode, checkNodeLB, checkNodeSB, enterCriticalSection, getFirstNode, getNextNode, getSmallBlock, internalAssert, leaveCriticalSection, and SmallBlockPoolSize.

Referenced by checkHeap, and free.

bool NLMISC::CHeapAllocator::isNodeBlack const CFreeNode   current [static, private]
 

Referenced by erase.

bool NLMISC::CHeapAllocator::isNodeFree const CNodeBegin   current [static, private]
 

Referenced by debugStatisticsReport, free, getFreeMemory, and mergeNode.

bool NLMISC::CHeapAllocator::isNodeLast const CNodeBegin   current [static, private]
 

Referenced by mergeNode, and splitNode.

bool NLMISC::CHeapAllocator::isNodeRed const CFreeNode   current [static, private]
 

Referenced by erase, and insert.

bool NLMISC::CHeapAllocator::isNodeSmall const CNodeBegin   current [static, private]
 

bool NLMISC::CHeapAllocator::isNodeUsed const CNodeBegin   current [static, private]
 

Referenced by debugGetAllocatedMemoryByCategory, debugReportMemoryLeak, debugStatisticsReport, getAllocatedMemory, and getFragmentationRatio.

void NLMISC::CHeapAllocator::leaveCriticalSection   const [private]
 

Referenced by CHeapAllocator, debugGetAllocatedMemoryByCategory, debugGetLBDebugInfoSize, debugGetSBDebugInfoSize, freeAll, getAllocatedMemory, getFragmentationRatio, getFreeMemory, getSmallBlockMemory, getTotalMemoryUsed, internalCheckHeap, releaseMemory, and setName.

void NLMISC::CHeapAllocator::leaveCriticalSectionLB   const [private]
 

Referenced by free.

void NLMISC::CHeapAllocator::leaveCriticalSectionSB   const [private]
 

Referenced by free.

void NLMISC::CHeapAllocator::mergeNode CNodeBegin   node [inline, static, private]
 

Definition at line 526 of file misc/heap_allocator.cpp.

References DeletedMemory, getNextNode, getNodeSize, internalAssert, isNodeFree, isNodeLast, NL_UPDATE_MAGIC_NUMBER, setNodeLast, and setNodeSize.

Referenced by free.

void* NLMISC::CHeapAllocator::reallocate void *    ptr,
uint    size,
const char *    sourceFile,
uint    line,
const char *    category
 

void NLMISC::CHeapAllocator::releaseMemory  
 

Definition at line 1873 of file misc/heap_allocator.cpp.

References _FreeTreeRoot, _MainBlockList, _NullNode, enterCriticalSection, freeBlock, NLMISC::CHeapAllocator::CNullNode::FreeNode, and leaveCriticalSection.

Referenced by ~CHeapAllocator.

void NLMISC::CHeapAllocator::rotateLeft CFreeNode   x [inline, private]
 

Referenced by erase, and insert.

void NLMISC::CHeapAllocator::rotateRight CFreeNode   x [inline, private]
 

Referenced by erase, and insert.

void NLMISC::CHeapAllocator::setBlockAllocationMode TBlockAllocationMode    mode
 

bool NLMISC::CHeapAllocator::setMainBlockCount uint    blockCount
 

bool NLMISC::CHeapAllocator::setMainBlockSize uint    mainBlockSize
 

void NLMISC::CHeapAllocator::setName const char *    name
 

Definition at line 2154 of file misc/heap_allocator.cpp.

References _Name, enterCriticalSection, leaveCriticalSection, and NameLength.

void NLMISC::CHeapAllocator::setNextSmallBlock CNodeBegin   previous,
CNodeBegin   next
[static, private]
 

void NLMISC::CHeapAllocator::setNodeBlack CFreeNode   current [static, private]
 

Referenced by CHeapAllocator, erase, and insert.

void NLMISC::CHeapAllocator::setNodeColor CFreeNode   current,
bool    red
[static, private]
 

Referenced by erase.

void NLMISC::CHeapAllocator::setNodeFree CNodeBegin   current [static, private]
 

Referenced by free, initEmptyBlock, and splitNode.

void NLMISC::CHeapAllocator::setNodeLast CNodeBegin   current,
bool    last
[static, private]
 

Referenced by initEmptyBlock, mergeNode, and splitNode.

void NLMISC::CHeapAllocator::setNodeRed CFreeNode   current [static, private]
 

Referenced by erase, and insert.

void NLMISC::CHeapAllocator::setNodeSize CNodeBegin   current,
uint    size
[static, private]
 

Referenced by initEmptyBlock, mergeNode, and splitNode.

void NLMISC::CHeapAllocator::setNodeUsed CNodeBegin   current [static, private]
 

void NLMISC::CHeapAllocator::setOutOfMemoryMode TOutOfMemoryMode    mode
 

CHeapAllocator::CNodeBegin * NLMISC::CHeapAllocator::splitNode CNodeBegin   node,
uint    newSize
[inline, private]
 

Definition at line 441 of file misc/heap_allocator.cpp.

References Align, BeginNodeMarkers, CategoryStringLength, EndNodeMarkers, getNextNode, getNodeSize, internalAssert, isNodeLast, NL_UPDATE_MAGIC_NUMBER, setNodeFree, setNodeLast, setNodeSize, and UserDataBlockSizeMin.


Member Data Documentation

uint32 NLMISC::CHeapAllocator::_AllocateCount [private]
 

Definition at line 393 of file include/nel/misc/heap_allocator.h.

Referenced by CHeapAllocator.

bool NLMISC::CHeapAllocator::_AlwaysCheck [private]
 

Definition at line 380 of file include/nel/misc/heap_allocator.h.

Referenced by CHeapAllocator, debugAlwaysCheckMemory, and debugIsAlwaysCheckMemory.

TBlockAllocationMode NLMISC::CHeapAllocator::_BlockAllocationMode [private]
 

Definition at line 377 of file include/nel/misc/heap_allocator.h.

Referenced by CHeapAllocator.

uint NLMISC::CHeapAllocator::_BlockCount [private]
 

Definition at line 376 of file include/nel/misc/heap_allocator.h.

Referenced by CHeapAllocator.

CTDS NLMISC::CHeapAllocator::_CategoryStack [private]
 

Definition at line 479 of file include/nel/misc/heap_allocator.h.

Referenced by debugPopCategoryString, and debugPushCategoryString.

volatile CNodeBegin* NLMISC::CHeapAllocator::_FreeSmallBlocks[NL_SMALLBLOCK_COUNT] [private]
 

Definition at line 452 of file include/nel/misc/heap_allocator.h.

Referenced by CHeapAllocator, and free.

CFreeNode* NLMISC::CHeapAllocator::_FreeTreeRoot [private]
 

Definition at line 387 of file include/nel/misc/heap_allocator.h.

Referenced by CHeapAllocator, erase, freeAll, insert, internalCheckHeap, and releaseMemory.

CMainBlock* NLMISC::CHeapAllocator::_MainBlockList [private]
 

Definition at line 384 of file include/nel/misc/heap_allocator.h.

Referenced by CHeapAllocator, debugGetAllocatedMemoryByCategory, debugGetLBDebugInfoSize, debugReportMemoryLeak, debugStatisticsReport, freeAll, getAllocatedMemory, getAllocatedSystemMemoryByAllocator, getFragmentationRatio, getFreeMemory, getTotalMemoryUsed, internalCheckHeap, and releaseMemory.

uint NLMISC::CHeapAllocator::_MainBlockSize [private]
 

Definition at line 375 of file include/nel/misc/heap_allocator.h.

Referenced by CHeapAllocator.

CAllocatorMutex NLMISC::CHeapAllocator::_MutexLB [private]
 

Definition at line 389 of file include/nel/misc/heap_allocator.h.

CAllocatorMutex NLMISC::CHeapAllocator::_MutexSB [private]
 

Definition at line 455 of file include/nel/misc/heap_allocator.h.

char NLMISC::CHeapAllocator::_Name[NameLength] [private]
 

Definition at line 391 of file include/nel/misc/heap_allocator.h.

Referenced by CHeapAllocator, debugReportMemoryLeak, debugStatisticsReport, and setName.

CNullNode NLMISC::CHeapAllocator::_NullNode [private]
 

Definition at line 388 of file include/nel/misc/heap_allocator.h.

Referenced by CHeapAllocator, erase, freeAll, insert, and releaseMemory.

TOutOfMemoryMode NLMISC::CHeapAllocator::_OutOfMemoryMode [private]
 

Definition at line 378 of file include/nel/misc/heap_allocator.h.

Referenced by CHeapAllocator.

volatile CSmallBlockPool* NLMISC::CHeapAllocator::_SmallBlockPool [private]
 

Definition at line 453 of file include/nel/misc/heap_allocator.h.

Referenced by CHeapAllocator, debugGetAllocatedMemoryByCategory, debugGetSBDebugInfoSize, debugReportMemoryLeak, debugStatisticsReport, getAllocatedMemory, getFreeMemory, getSmallBlockMemory, and internalCheckHeap.


The documentation for this class was generated from the following files: