diff options
Diffstat (limited to 'docs/doxygen/nel/a02609.html')
-rw-r--r-- | docs/doxygen/nel/a02609.html | 5972 |
1 files changed, 5972 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a02609.html b/docs/doxygen/nel/a02609.html new file mode 100644 index 00000000..8539cf5b --- /dev/null +++ b/docs/doxygen/nel/a02609.html @@ -0,0 +1,5972 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NLMISC::CHeapAllocator class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NLMISC::CHeapAllocator Class Reference</h1><code>#include <<a class="el" href="a05778.html">heap_allocator.h</a>></code> +<p> +<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Small Block</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>enum </td><td class="memItemRight" valign=bottom>{ <br> + <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw13">SmallBlockGranularityShift</a> = 3, +<a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw12">SmallBlockGranularity</a> = 1<<SmallBlockGranularityShift, +<a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw6">FirstSmallBlock</a> = 8, +<a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw8">LastSmallBlock</a> = 128, +<br> + <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw14">SmallBlockPoolSize</a> = 20 +<br> + }</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_1">checkNodeSB</a> (const <a class="el" href="a02625.html">CSmallBlockPool</a> *mainBlock, const <a class="el" href="a02619.html">CNodeBegin</a> *previous, const <a class="el" href="a02619.html">CNodeBegin</a> *current, const <a class="el" href="a02619.html">CNodeBegin</a> *next, bool stopOnError) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>volatile <a class="el" href="a02619.html">CNodeBegin</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_2">_FreeSmallBlocks</a> [(1+(LastSmallBlock-FirstSmallBlock)/SmallBlockGranularity)]</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02516.html">CAllocatorMutex</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_3">_MutexSB</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>volatile <a class="el" href="a02625.html">CSmallBlockPool</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_4">_SmallBlockPool</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02619.html">CNodeBegin</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_5">getNextSmallBlock</a> (<a class="el" href="a02619.html">CNodeBegin</a> *previous)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02619.html">CNodeBegin</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_6">getSmallBlock</a> (<a class="el" href="a02625.html">CSmallBlockPool</a> *smallBlock, <a class="el" href="a04558.html#a15">uint</a> blockIndex)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_7">setNextSmallBlock</a> (<a class="el" href="a02619.html">CNodeBegin</a> *previous, <a class="el" href="a02619.html">CNodeBegin</a> *next)</td></tr> + +<tr><td colspan=2><br><h2>Category control</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1953_0">debugPopCategoryString</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1953_1">debugPushCategoryString</a> (const char *str)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03473.html">CTDS</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1953_2">_CategoryStack</a></td></tr> + +<tr><td colspan=2><br><h2>Public Types</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>enum </td><td class="memItemRight" valign=bottom>{ <br> + <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw10">ReleaseHeaderSize</a> = 8, +<a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw2">CategoryStringLength</a> = 8, +<a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw1">BeginNodeMarkers</a> = '<', +<a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw5">EndNodeMarkers</a> = '>', +<br> + <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw19">UnallocatedMemory</a> = 0xba, +<a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw20">UninitializedMemory</a> = 0xbc, +<a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw3">DeletedMemory</a> = 0xbd, +<a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw9">NameLength</a> = 32 +<br> + }</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>enum </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw15">TBlockAllocationMode</a> { <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw15NLMISC_1_1CHeapAllocatorw7">Grow</a>, +<a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw15NLMISC_1_1CHeapAllocatorw4">DontGrow</a> + }</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef char </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw16">TCategoryString</a> [CategoryStringLength]</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>enum </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw18">TOutOfMemoryMode</a> { <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw18NLMISC_1_1CHeapAllocatorw17">ThrowException</a>, +<a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw18NLMISC_1_1CHeapAllocatorw11">ReturnNull</a> + }</td></tr> + +<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora0">allocate</a> (<a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a587">size</a>, const char *sourceFile, <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04560.html#a2">line</a>, const char *category)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>virtual <a class="el" href="a04558.html#a7">uint8</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora1">allocateBlock</a> (<a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a587">size</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora2">CHeapAllocator</a> (<a class="el" href="a04558.html#a15">uint</a> mainBlockSize=1024 *1024 *10, <a class="el" href="a04558.html#a15">uint</a> blockCount=1, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw15">TBlockAllocationMode</a> blockAllocationMode=Grow, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw18">TOutOfMemoryMode</a> outOfMemoryMode=ThrowException)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora3">checkHeap</a> (bool stopOnError) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora4">debugAlwaysCheckMemory</a> (bool alwaysCheck)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora5">debugGetAllocatedMemoryByCategory</a> (const char *category) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora6">debugGetDebugInfoSize</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora7">debugGetLBDebugInfoSize</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora8">debugGetSBDebugInfoSize</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora9">debugIsAlwaysCheckMemory</a> (bool alwaysCheck) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora10">debugReportMemoryLeak</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora11">debugStatisticsReport</a> (const char *stateFile, bool memoryMap)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora12">free</a> (void *ptr)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora13">freeAll</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora14">freeBlock</a> (<a class="el" href="a04558.html#a7">uint8</a> *block)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora15">getAllocatedMemory</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora16">getAllocatedSystemMemoryByAllocator</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw15">TBlockAllocationMode</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora17">getBlockAllocationMode</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora18">getFragmentationRatio</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora19">getFreeMemory</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora20">getMainBlockCount</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora21">getMainBlockSize</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>const char * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora22">getName</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw18">TOutOfMemoryMode</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora23">getOutOfMemoryMode</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora24">getSmallBlockMemory</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora25">getTotalMemoryUsed</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora26">reallocate</a> (void *ptr, <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a587">size</a>, const char *sourceFile, <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04560.html#a2">line</a>, const char *category)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora27">releaseMemory</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora28">setBlockAllocationMode</a> (<a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw15">TBlockAllocationMode</a> mode)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora29">setMainBlockCount</a> (<a class="el" href="a04558.html#a15">uint</a> blockCount)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora30">setMainBlockSize</a> (<a class="el" href="a04558.html#a15">uint</a> mainBlockSize)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora31">setName</a> (const char *name)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora32">setOutOfMemoryMode</a> (<a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw18">TOutOfMemoryMode</a> mode)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>virtual </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatora33">~CHeapAllocator</a> ()</td></tr> + +<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatore0">getAllocatedSystemMemory</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatore1">getBlockSize</a> (void *block)</td></tr> + +<tr><td colspan=2><br><h2>Private Types</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>enum </td><td class="memItemRight" valign=bottom>{ <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatory0NLMISC_1_1CHeapAllocatory5">FreeNodeBlockSize</a> = 128, +<a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatory0NLMISC_1_1CHeapAllocatory7">FreeNodeBlockSizeShift</a> = 7, +<a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatory0NLMISC_1_1CHeapAllocatory6">FreeNodeBlockSizeMask</a> = 0x7f + }</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>enum </td><td class="memItemRight" valign=bottom>{ <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatory1NLMISC_1_1CHeapAllocatory3">Align</a> = 8, +<a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatory1NLMISC_1_1CHeapAllocatory4">BlockDataSizeMin</a> = 1<<4 + }</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>enum </td><td class="memItemRight" valign=bottom>{ <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatory2NLMISC_1_1CHeapAllocatory8">UserDataBlockSizeMin</a> = sizeof(CFreeNode) + }</td></tr> + +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord0">checkFreeNode</a> (const <a class="el" href="a02613.html">CFreeNode</a> *current, bool stopOnError, bool recurse) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord1">checkNode</a> (const <a class="el" href="a02619.html">CNodeBegin</a> *current, <a class="el" href="a04558.html#a11">uint32</a> crc) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord2">checkNodeLB</a> (const <a class="el" href="a02615.html">CMainBlock</a> *mainBlock, const <a class="el" href="a02619.html">CNodeBegin</a> *previous, const <a class="el" href="a02619.html">CNodeBegin</a> *current, const <a class="el" href="a02619.html">CNodeBegin</a> *next, bool stopOnError) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord4">enterCriticalSectionLB</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord5">enterCriticalSectionSB</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord6">erase</a> (<a class="el" href="a02613.html">CFreeNode</a> *<a class="el" href="a04223.html#a574">z</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02613.html">CFreeNode</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord7">find</a> (<a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a587">size</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord8">initEmptyBlock</a> (<a class="el" href="a02615.html">CMainBlock</a> &mainBlock)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord9">insert</a> (<a class="el" href="a02613.html">CFreeNode</a> *<a class="el" href="a04223.html#a572">x</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord10">internalCheckHeap</a> (bool stopOnError) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord12">leaveCriticalSectionLB</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord13">leaveCriticalSectionSB</a> () const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord14">rotateLeft</a> (<a class="el" href="a02613.html">CFreeNode</a> *<a class="el" href="a04223.html#a572">x</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord15">rotateRight</a> (<a class="el" href="a02613.html">CFreeNode</a> *<a class="el" href="a04223.html#a572">x</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02619.html">CNodeBegin</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord16">splitNode</a> (<a class="el" href="a02619.html">CNodeBegin</a> *node, <a class="el" href="a04558.html#a15">uint</a> newSize)</td></tr> + +<tr><td colspan=2><br><h2>Static Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh0">computeCRC32</a> (<a class="el" href="a04558.html#a11">uint32</a> &crc, const void *<a class="el" href="a04223.html#a589">buffer</a>, unsigned int <a class="el" href="a04223.html#a577">count</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh1">evalMagicNumber</a> (const <a class="el" href="a02619.html">CNodeBegin</a> *node)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02619.html">CNodeBegin</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh2">getFirstNode</a> (<a class="el" href="a02615.html">CMainBlock</a> *mainBlock)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a02619.html">CNodeBegin</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode</a> (const <a class="el" href="a02615.html">CMainBlock</a> *mainBlock)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02613.html">CFreeNode</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh4">getFreeNode</a> (<a class="el" href="a02619.html">CNodeBegin</a> *current)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a02613.html">CFreeNode</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh5">getFreeNode</a> (const <a class="el" href="a02619.html">CNodeBegin</a> *current)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02619.html">CNodeBegin</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh6">getNextNode</a> (<a class="el" href="a02619.html">CNodeBegin</a> *current)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a02619.html">CNodeBegin</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode</a> (const <a class="el" href="a02619.html">CNodeBegin</a> *current)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02619.html">CNodeBegin</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh8">getNode</a> (<a class="el" href="a02613.html">CFreeNode</a> *current)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a02619.html">CNodeBegin</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh9">getNode</a> (const <a class="el" href="a02613.html">CFreeNode</a> *current)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (const <a class="el" href="a02619.html">CNodeBegin</a> *current)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh11">isNodeBlack</a> (const <a class="el" href="a02613.html">CFreeNode</a> *current)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh12">isNodeFree</a> (const <a class="el" href="a02619.html">CNodeBegin</a> *current)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh13">isNodeLast</a> (const <a class="el" href="a02619.html">CNodeBegin</a> *current)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh14">isNodeRed</a> (const <a class="el" href="a02613.html">CFreeNode</a> *current)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh15">isNodeSmall</a> (const <a class="el" href="a02619.html">CNodeBegin</a> *current)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh16">isNodeUsed</a> (const <a class="el" href="a02619.html">CNodeBegin</a> *current)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh17">mergeNode</a> (<a class="el" href="a02619.html">CNodeBegin</a> *node)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack</a> (<a class="el" href="a02613.html">CFreeNode</a> *current)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh19">setNodeColor</a> (<a class="el" href="a02613.html">CFreeNode</a> *current, bool red)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh20">setNodeFree</a> (<a class="el" href="a02619.html">CNodeBegin</a> *current)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh21">setNodeLast</a> (<a class="el" href="a02619.html">CNodeBegin</a> *current, bool last)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh22">setNodeRed</a> (<a class="el" href="a02613.html">CFreeNode</a> *current)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh23">setNodeSize</a> (<a class="el" href="a02619.html">CNodeBegin</a> *current, <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a587">size</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh24">setNodeUsed</a> (<a class="el" href="a02619.html">CNodeBegin</a> *current)</td></tr> + +<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr0">_AllocateCount</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr1">_AlwaysCheck</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw15">TBlockAllocationMode</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr2">_BlockAllocationMode</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr3">_BlockCount</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02613.html">CFreeNode</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr4">_FreeTreeRoot</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02615.html">CMainBlock</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr5">_MainBlockList</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr6">_MainBlockSize</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02516.html">CAllocatorMutex</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr7">_MutexLB</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>char </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr8">_Name</a> [NameLength]</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02623.html">CNullNode</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr9">_NullNode</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw18">TOutOfMemoryMode</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr10">_OutOfMemoryMode</a></td></tr> + +</table> +<hr><h2>Member Typedef Documentation</h2> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorw16" doxytag="NLMISC::CHeapAllocator::TCategoryString" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> typedef char <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw16">NLMISC::CHeapAllocator::TCategoryString</a>[CategoryStringLength] + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05778.html#l00106">106</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. </td> + </tr> +</table> +<hr><h2>Member Enumeration Documentation</h2> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorw0" doxytag="NLMISC::CHeapAllocator::@71" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> anonymous enum + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +<dl compact><dt><b>Enumeration values: </b></dt><dd> +<table border=0 cellspacing=2 cellpadding=0> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw10" doxytag="ReleaseHeaderSize" ></a>ReleaseHeaderSize</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw2" doxytag="CategoryStringLength" ></a>CategoryStringLength</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw1" doxytag="BeginNodeMarkers" ></a>BeginNodeMarkers</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw5" doxytag="EndNodeMarkers" ></a>EndNodeMarkers</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw19" doxytag="UnallocatedMemory" ></a>UnallocatedMemory</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw20" doxytag="UninitializedMemory" ></a>UninitializedMemory</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw3" doxytag="DeletedMemory" ></a>DeletedMemory</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw9" doxytag="NameLength" ></a>NameLength</em> </td><td> +</td></tr> +</table> +</dl> + +<p> +Definition at line <a class="el" href="a05778.html#l00070">70</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. +<p> +<div class="fragment"><pre>00071 { +00072 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw10">ReleaseHeaderSize</a> = 8, +00073 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw2">CategoryStringLength</a> = 8, +00074 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw1">BeginNodeMarkers</a> = <span class="charliteral">'<'</span>, +00075 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw5">EndNodeMarkers</a> = <span class="charliteral">'>'</span>, +00076 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw19">UnallocatedMemory</a> = 0xba, +00077 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw20">UninitializedMemory</a> = 0xbc, +00078 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw3">DeletedMemory</a> = 0xbd, +00079 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw9">NameLength</a> = 32 +00080 }; +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatory0" doxytag="NLMISC::CHeapAllocator::@72" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> anonymous enum<code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +<dl compact><dt><b>Enumeration values: </b></dt><dd> +<table border=0 cellspacing=2 cellpadding=0> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatory0NLMISC_1_1CHeapAllocatory5" doxytag="FreeNodeBlockSize" ></a>FreeNodeBlockSize</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatory0NLMISC_1_1CHeapAllocatory7" doxytag="FreeNodeBlockSizeShift" ></a>FreeNodeBlockSizeShift</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatory0NLMISC_1_1CHeapAllocatory6" doxytag="FreeNodeBlockSizeMask" ></a>FreeNodeBlockSizeMask</em> </td><td> +</td></tr> +</table> +</dl> + +<p> +Definition at line <a class="el" href="a05778.html#l00205">205</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. +<p> +<div class="fragment"><pre>00206 { +00207 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatory0NLMISC_1_1CHeapAllocatory5">FreeNodeBlockSize</a> = 128, +00208 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatory0NLMISC_1_1CHeapAllocatory7">FreeNodeBlockSizeShift</a> = 7, +00209 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatory0NLMISC_1_1CHeapAllocatory6">FreeNodeBlockSizeMask</a> = 0x7f +00210 }; +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatory1" doxytag="NLMISC::CHeapAllocator::@73" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> anonymous enum<code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +<dl compact><dt><b>Enumeration values: </b></dt><dd> +<table border=0 cellspacing=2 cellpadding=0> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatory1NLMISC_1_1CHeapAllocatory3" doxytag="Align" ></a>Align</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatory1NLMISC_1_1CHeapAllocatory4" doxytag="BlockDataSizeMin" ></a>BlockDataSizeMin</em> </td><td> +</td></tr> +</table> +</dl> + +<p> +Definition at line <a class="el" href="a05778.html#l00213">213</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. +<p> +<div class="fragment"><pre>00214 { +00215 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatory1NLMISC_1_1CHeapAllocatory3">Align</a> = 8, +00216 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatory1NLMISC_1_1CHeapAllocatory4">BlockDataSizeMin</a> = 1<<4 +00217 }; +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatory2" doxytag="NLMISC::CHeapAllocator::@74" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> anonymous enum<code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +<dl compact><dt><b>Enumeration values: </b></dt><dd> +<table border=0 cellspacing=2 cellpadding=0> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatory2NLMISC_1_1CHeapAllocatory8" doxytag="UserDataBlockSizeMin" ></a>UserDataBlockSizeMin</em> </td><td> +</td></tr> +</table> +</dl> + +<p> +Definition at line <a class="el" href="a05778.html#l00330">330</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. +<p> +<div class="fragment"><pre>00331 { +00332 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatory2NLMISC_1_1CHeapAllocatory8">UserDataBlockSizeMin</a> = <span class="keyword">sizeof</span>(CFreeNode) +00333 }; +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorz1952_0" doxytag="NLMISC::CHeapAllocator::@75" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> anonymous enum + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +<dl compact><dt><b>Enumeration values: </b></dt><dd> +<table border=0 cellspacing=2 cellpadding=0> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw13" doxytag="SmallBlockGranularityShift" ></a>SmallBlockGranularityShift</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw12" doxytag="SmallBlockGranularity" ></a>SmallBlockGranularity</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw6" doxytag="FirstSmallBlock" ></a>FirstSmallBlock</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw8" doxytag="LastSmallBlock" ></a>LastSmallBlock</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw14" doxytag="SmallBlockPoolSize" ></a>SmallBlockPoolSize</em> </td><td> +</td></tr> +</table> +</dl> + +<p> +Definition at line <a class="el" href="a05778.html#l00403">403</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. +<p> +<div class="fragment"><pre>00404 { +00405 <span class="comment">// Small block granularity</span> +00406 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw13">SmallBlockGranularityShift</a> = 3, +00407 +00408 <span class="comment">// Small block granularity</span> +00409 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw12">SmallBlockGranularity</a> = 1<<<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw13">SmallBlockGranularityShift</a>, +00410 +00411 <span class="comment">// Smallest block size</span> +00412 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw6">FirstSmallBlock</a> = 8, +00413 +00414 <span class="comment">// Largest block size</span> +00415 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw8">LastSmallBlock</a> = 128, +00416 +00417 <span class="comment">// Size of a smallblock pool</span> +00418 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw14">SmallBlockPoolSize</a> = 20 +00419 }; +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorw15" doxytag="NLMISC::CHeapAllocator::TBlockAllocationMode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> enum <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw15">NLMISC::CHeapAllocator::TBlockAllocationMode</a> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Block allocation mode.<dl compact><dt><b>Enumeration values: </b></dt><dd> +<table border=0 cellspacing=2 cellpadding=0> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatorw15NLMISC_1_1CHeapAllocatorw7" doxytag="Grow" ></a>Grow</em> </td><td> +When the allocator runs out of memory, allocate a new block. </td></tr> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatorw15NLMISC_1_1CHeapAllocatorw4" doxytag="DontGrow" ></a>DontGrow</em> </td><td> +When the allocator runs out of memory, returns a out of memory signal. </td></tr> +</table> +</dl> + +<p> +Definition at line <a class="el" href="a05778.html#l00085">85</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. +<p> +<div class="fragment"><pre>00086 { +00088 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw15NLMISC_1_1CHeapAllocatorw7">Grow</a>, +00089 +00091 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw15NLMISC_1_1CHeapAllocatorw4">DontGrow</a> +00092 }; +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorw18" doxytag="NLMISC::CHeapAllocator::TOutOfMemoryMode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> enum <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw18">NLMISC::CHeapAllocator::TOutOfMemoryMode</a> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Out of memory signal<dl compact><dt><b>Enumeration values: </b></dt><dd> +<table border=0 cellspacing=2 cellpadding=0> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatorw18NLMISC_1_1CHeapAllocatorw17" doxytag="ThrowException" ></a>ThrowException</em> </td><td> +When the allocator runs out of memory, throw an exception. </td></tr> +<tr><td valign=top><em><a class="anchor" name="NLMISC_1_1CHeapAllocatorw18NLMISC_1_1CHeapAllocatorw11" doxytag="ReturnNull" ></a>ReturnNull</em> </td><td> +When the allocator runs out of memory, returns NULL. </td></tr> +</table> +</dl> + +<p> +Definition at line <a class="el" href="a05778.html#l00097">97</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. +<p> +<div class="fragment"><pre>00098 { +00100 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw18NLMISC_1_1CHeapAllocatorw17">ThrowException</a>, +00101 +00103 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw18NLMISC_1_1CHeapAllocatorw11">ReturnNull</a> +00104 }; +</pre></div> </td> + </tr> +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora2" doxytag="NLMISC::CHeapAllocator::CHeapAllocator" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLMISC::CHeapAllocator::CHeapAllocator </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>mainBlockSize</em> = 1024 *1024 *10, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>blockCount</em> = 1, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw15">TBlockAllocationMode</a> </td> + <td class="mdname" nowrap> <em>blockAllocationMode</em> = Grow, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw18">TOutOfMemoryMode</a> </td> + <td class="mdname" nowrap> <em>outOfMemoryMode</em> = ThrowException</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l00071">71</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection()</a>, <a class="el" href="a05778.html#l00372">NLMISC::CHeapAllocator::CNullNode::FreeNode</a>, <a class="el" href="a05779.html#l00032">internalAssert</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection()</a>, <a class="el" href="a05778.html#l00324">NLMISC::CHeapAllocator::CFreeNode::Left</a>, <a class="el" href="a05777.html#l00324">NL_HEAP_NODE_END_SIZE</a>, <a class="el" href="a05777.html#l00501">NL_SMALLBLOCK_COUNT</a>, <a class="el" href="a05778.html#l00326">NLMISC::CHeapAllocator::CFreeNode::Parent</a>, <a class="el" href="a05778.html#l00325">NLMISC::CHeapAllocator::CFreeNode::Right</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>00073 { +00074 <span class="comment">// Critical section</span> +00075 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection</a> (); +00076 +00077 <span class="comment">// Allocator name</span> +00078 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr8">_Name</a>[0] = 0; +00079 +00080 <span class="comment">// Check size of structures must be aligned</span> +00081 <a class="code" href="a04356.html#a0">internalAssert</a> ((<span class="keyword">sizeof</span> (CNodeBegin) & (Align-1)) == 0); +00082 <a class="code" href="a04356.html#a0">internalAssert</a> ((NL_HEAP_NODE_END_SIZE & (Align-1)) == 0); +00083 <a class="code" href="a04356.html#a0">internalAssert</a> ((<span class="keyword">sizeof</span> (CFreeNode) & (Align-1)) == 0); +00084 +00085 <span class="comment">// Check small block sizes</span> +00086 <a class="code" href="a04356.html#a0">internalAssert</a> ((FirstSmallBlock&(SmallBlockGranularity-1)) == 0); +00087 <a class="code" href="a04356.html#a0">internalAssert</a> ((LastSmallBlock&(SmallBlockGranularity-1)) == 0); +00088 +00089 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr5">_MainBlockList</a> = NULL; +00090 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr6">_MainBlockSize</a> = mainBlockSize; +00091 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr3">_BlockCount</a> = blockCount; +00092 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr2">_BlockAllocationMode</a> = blockAllocationMode; +00093 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr10">_OutOfMemoryMode</a> = outOfMemoryMode; +00094 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr4">_FreeTreeRoot</a> = &<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr9">_NullNode</a>.<a class="code" href="a02623.html#NLMISC_1_1CHeapAllocator_1_1CNullNodeo0">FreeNode</a>; +00095 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00096 <span class="preprocessor"></span> <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr1">_AlwaysCheck</a> = <span class="keyword">false</span>; +00097 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00098 <span class="preprocessor"></span> +00099 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr9">_NullNode</a>.<a class="code" href="a02623.html#NLMISC_1_1CHeapAllocator_1_1CNullNodeo0">FreeNode</a>.<a class="code" href="a02613.html#NLMISC_1_1CHeapAllocator_1_1CFreeNodeo1">Left</a> = &<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr9">_NullNode</a>.<a class="code" href="a02623.html#NLMISC_1_1CHeapAllocator_1_1CNullNodeo0">FreeNode</a>; +00100 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr9">_NullNode</a>.<a class="code" href="a02623.html#NLMISC_1_1CHeapAllocator_1_1CNullNodeo0">FreeNode</a>.<a class="code" href="a02613.html#NLMISC_1_1CHeapAllocator_1_1CFreeNodeo3">Right</a> = &<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr9">_NullNode</a>.<a class="code" href="a02623.html#NLMISC_1_1CHeapAllocator_1_1CNullNodeo0">FreeNode</a>; +00101 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr9">_NullNode</a>.<a class="code" href="a02623.html#NLMISC_1_1CHeapAllocator_1_1CNullNodeo0">FreeNode</a>.<a class="code" href="a02613.html#NLMISC_1_1CHeapAllocator_1_1CFreeNodeo2">Parent</a> = NULL; +00102 +00103 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack</a> (&<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr9">_NullNode</a>.<a class="code" href="a02623.html#NLMISC_1_1CHeapAllocator_1_1CNullNodeo0">FreeNode</a>); +00104 +00105 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00106 <span class="preprocessor"></span> <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr0">_AllocateCount</a> = 0; +00107 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00108 <span class="preprocessor"></span> +00109 <span class="comment">// *********************************************************</span> +00110 <span class="comment">// Small Block</span> +00111 <span class="comment">// *********************************************************</span> +00112 +00113 <span class="comment">// The free smallblock array by size</span> +00114 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> smallBlockSizeCount = <a class="code" href="a04354.html#a3">NL_SMALLBLOCK_COUNT</a>; +00115 <a class="code" href="a04558.html#a15">uint</a> smallBlockSize; +00116 <span class="keywordflow">for</span> (smallBlockSize=0; smallBlockSize<smallBlockSizeCount; smallBlockSize++) +00117 { +00118 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_2">_FreeSmallBlocks</a>[smallBlockSize] = NULL; +00119 } +00120 +00121 <span class="comment">// No small block</span> +00122 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_4">_SmallBlockPool</a> = NULL; +00123 +00124 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection</a> (); +00125 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora33" doxytag="NLMISC::CHeapAllocator::~CHeapAllocator" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLMISC::CHeapAllocator::~<a class="el" href="a02609.html">CHeapAllocator</a> </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [virtual]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l00129">129</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05776.html#l01879">releaseMemory()</a>. +<p> +<div class="fragment"><pre>00130 { +00131 <span class="comment">// Release all memory used</span> +00132 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatora27">releaseMemory</a> (); +00133 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora0" doxytag="NLMISC::CHeapAllocator::allocate" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void * NLMISC::CHeapAllocator::allocate </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>size</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const char * </td> + <td class="mdname" nowrap> <em>sourceFile</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>line</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const char * </td> + <td class="mdname" nowrap> <em>category</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l00644">644</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05646.html#l00649">buffer</a>, <a class="el" href="a05778.html#l00265">NLMISC::CHeapAllocator::CNodeEnd::EndMarkers</a>, <a class="el" href="a05779.html#l00032">internalAssert</a>, <a class="el" href="a05778.html#l00474">NLMISC::CHeapAllocator::CCategory::Name</a>, <a class="el" href="a05777.html#l00050">NelAlloc</a>, <a class="el" href="a05778.html#l00307">NLMISC::CHeapAllocator::CMainBlock::Next</a>, <a class="el" href="a05778.html#l00425">NLMISC::CHeapAllocator::CSmallBlockPool::Next</a>, <a class="el" href="a05777.html#l00503">NL_ALIGN_SIZE_FOR_SMALLBLOCK</a>, <a class="el" href="a05779.html#l00060">NL_ALLOC_STOP</a>, <a class="el" href="a05777.html#l00324">NL_HEAP_NODE_END_SIZE</a>, <a class="el" href="a05775.html#l00919">NL_HEAP_SB_CATEGORY</a>, <a class="el" href="a05775.html#l00922">NL_HEAP_UNKNOWN_CATEGORY</a>, <a class="el" href="a05777.html#l00502">NL_SIZE_TO_SMALLBLOCK_INDEX</a>, <a class="el" href="a05777.html#l00501">NL_SMALLBLOCK_COUNT</a>, <a class="el" href="a05779.html#l00042">NL_UPDATE_MAGIC_NUMBER</a>, <a class="el" href="a05778.html#l00306">NLMISC::CHeapAllocator::CMainBlock::Ptr</a>, <a class="el" href="a05778.html#l00305">NLMISC::CHeapAllocator::CMainBlock::Size</a>, <a class="el" href="a05778.html#l00424">NLMISC::CHeapAllocator::CSmallBlockPool::Size</a>, <a class="el" href="a05646.html#l00645">size</a>, <a class="el" href="a05778.html#l00252">NLMISC::CHeapAllocator::CNodeBegin::SizeAndFlags</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>00646 { +00647 <span class="comment">// Check size is valid</span> +00648 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a587">size</a> != 0) +00649 { +00650 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00651 <span class="preprocessor"></span> <span class="comment">// If category is NULL</span> +00652 <span class="keywordflow">if</span> (category == NULL) +00653 { +00654 <span class="comment">// Get the current category</span> +00655 CCategory *cat = (CCategory*)<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1953_2">_CategoryStack</a>.<a class="code" href="a03473.html#NLMISC_1_1CTDSa1">getPointer</a> (); +00656 <span class="keywordflow">if</span> (cat) +00657 { +00658 category = cat->Name; +00659 } +00660 <span class="keywordflow">else</span> +00661 { +00662 <span class="comment">// Not yet initialised</span> +00663 category = <a class="code" href="a04352.html#a3">NL_HEAP_UNKNOWN_CATEGORY</a>; +00664 } +00665 } +00666 +00667 <span class="comment">// Checks ?</span> +00668 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr1">_AlwaysCheck</a>) +00669 { +00670 <span class="comment">// Check heap integrity</span> +00671 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord10">internalCheckHeap</a> (<span class="keyword">true</span>); +00672 } +00673 +00674 <span class="comment">// Check breakpoints</span> +00675 <span class="comment">/*if (_Breakpoints.find (_AllocateCount) != _Breakpoints.end())</span> +00676 <span class="comment"> {</span> +00677 <span class="comment"> // ********</span> +00678 <span class="comment"> // * STOP *</span> +00679 <span class="comment"> // ********</span> +00680 <span class="comment"> // * Breakpoints allocation</span> +00681 <span class="comment"> // ********</span> +00682 <span class="comment"> NL_ALLOC_STOP;</span> +00683 <span class="comment"> }*/</span> +00684 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00685 <span class="preprocessor"></span> +00686 <span class="comment">// Small or largs block ?</span> +00687 <span class="preprocessor">#ifdef NLMISC_HEAP_NO_SMALL_BLOCK_OPTIMIZATION</span> +00688 <span class="preprocessor"></span> <span class="keywordflow">if</span> (0) +00689 <span class="preprocessor">#else // NLMISC_HEAP_NO_SMALL_BLOCK_OPTIMIZATION</span> +00690 <span class="preprocessor"></span> <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a587">size</a> <= <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw8">LastSmallBlock</a>) +00691 <span class="preprocessor">#endif// NLMISC_HEAP_NO_SMALL_BLOCK_OPTIMIZATION</span> +00692 <span class="preprocessor"></span> { +00693 <span class="comment">// *******************</span> +00694 <span class="comment">// Small block</span> +00695 <span class="comment">// *******************</span> +00696 +00697 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord5">enterCriticalSectionSB</a> (); +00698 +00699 <span class="comment">// Get pointer on the free block list</span> +00700 CNodeBegin **freeNode = (CNodeBegin **)<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_2">_FreeSmallBlocks</a>+<a class="code" href="a04354.html#a4">NL_SIZE_TO_SMALLBLOCK_INDEX</a> (size); +00701 +00702 <span class="comment">// Not found ?</span> +00703 <span class="keywordflow">if</span> (*freeNode == NULL) +00704 { +00705 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord13">leaveCriticalSectionSB</a> (); +00706 +00707 <span class="comment">// Size must be aligned</span> +00708 <a class="code" href="a04558.html#a15">uint</a> alignedSize = <a class="code" href="a04354.html#a5">NL_ALIGN_SIZE_FOR_SMALLBLOCK</a> (size); +00709 +00710 <span class="comment">// Use internal allocator</span> +00711 CSmallBlockPool *smallBlock = (CSmallBlockPool *)<a class="code" href="a04354.html#a0">NelAlloc</a> (*<span class="keyword">this</span>, <span class="keyword">sizeof</span>(CSmallBlockPool) + SmallBlockPoolSize * (<span class="keyword">sizeof</span>(CNodeBegin) + alignedSize + +00712 NL_HEAP_NODE_END_SIZE), NL_HEAP_SB_CATEGORY); +00713 +00714 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord5">enterCriticalSectionSB</a> (); +00715 +00716 <span class="comment">// Link this new block</span> +00717 smallBlock->Size = alignedSize; +00718 smallBlock->Next = (CSmallBlockPool*)<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_4">_SmallBlockPool</a>; +00719 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_4">_SmallBlockPool</a> = smallBlock; +00720 +00721 <span class="comment">// Initialize the block</span> +00722 <a class="code" href="a04558.html#a15">uint</a> pool; +00723 CNodeBegin *nextNode = *freeNode; +00724 <span class="keywordflow">for</span> (pool=0; pool<<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw14">SmallBlockPoolSize</a>; pool++) +00725 { +00726 <span class="comment">// Get the pool</span> +00727 CNodeBegin *node = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_6">getSmallBlock</a> (smallBlock, pool); +00728 +00729 <span class="comment">// Set as free</span> +00730 node->SizeAndFlags = alignedSize; +00731 +00732 <span class="comment">// Insert in the list</span> +00733 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_7">setNextSmallBlock</a> (node, nextNode); +00734 nextNode = node; +00735 +00736 <span class="comment">// Set debug informations</span> +00737 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00738 <span class="preprocessor"></span> <span class="comment">// Set node free</span> +00739 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh20">setNodeFree</a> (node); +00740 +00741 <span class="comment">// End magic number</span> +00742 node->EndMagicNumber = (<a class="code" href="a04558.html#a11">uint32</a>*)(CNodeEnd*)((<a class="code" href="a04558.html#a7">uint8</a>*)node + <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (node) + <span class="keyword">sizeof</span> (CNodeBegin)); +00743 +00744 <span class="comment">// Begin markers</span> +00745 memset (node->BeginMarkers, BeginNodeMarkers, CNodeBegin::MarkerSize-1); +00746 node->BeginMarkers[CNodeBegin::MarkerSize-1] = 0; +00747 +00748 <span class="comment">// End markers</span> +00749 CNodeEnd *endNode = (CNodeEnd*)((<a class="code" href="a04558.html#a7">uint8</a>*)node + <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (node) + <span class="keyword">sizeof</span> (CNodeBegin)); +00750 memset (endNode->EndMarkers, EndNodeMarkers, CNodeEnd::MarkerSize-1); +00751 endNode->EndMarkers[CNodeEnd::MarkerSize-1] = 0; +00752 +00753 <span class="comment">// Unallocated memory</span> +00754 memset ((<a class="code" href="a04558.html#a7">uint8</a>*)node + <span class="keyword">sizeof</span>(CNodeBegin), UnallocatedMemory, getNodeSize (node) ); +00755 +00756 <span class="comment">// No source file</span> +00757 memset (node->Category, 0, CategoryStringLength); +00758 node->File = NULL; +00759 node->Line = 0xffff; +00760 node->AllocateNumber = 0xffffffff; +00761 +00762 <span class="comment">// Heap pointer</span> +00763 node->Heap = <span class="keyword">this</span>; +00764 +00765 <a class="code" href="a04356.html#a1">NL_UPDATE_MAGIC_NUMBER</a> (node); +00766 +00767 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00768 <span class="preprocessor"></span> } +00769 +00770 <span class="comment">// Link the new blocks</span> +00771 *freeNode = nextNode; +00772 } +00773 +00774 <span class="comment">// Check allocation as been done</span> +00775 <a class="code" href="a04356.html#a0">internalAssert</a> (*freeNode); +00776 +00777 <span class="comment">// Get a node</span> +00778 CNodeBegin *node = *freeNode; +00779 +00780 <span class="comment">// Checks</span> +00781 <a class="code" href="a04356.html#a0">internalAssert</a> (size <= getNodeSize (node)); +00782 <a class="code" href="a04356.html#a0">internalAssert</a> ((NL_SIZE_TO_SMALLBLOCK_INDEX (size)) < (NL_SMALLBLOCK_COUNT)); +00783 +00784 <span class="comment">// Relink</span> +00785 *freeNode = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_5">getNextSmallBlock</a> (node); +00786 +00787 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG </span> +00788 <span class="preprocessor"></span> <span class="comment">// Check the node CRC</span> +00789 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord1">checkNode</a> (node, evalMagicNumber (node)); +00790 +00791 <span class="comment">// Set node free for checks</span> +00792 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh24">setNodeUsed</a> (node); +00793 +00794 <span class="comment">// Fill category</span> +00795 strncpy (node->Category, category, CategoryStringLength-1); +00796 +00797 <span class="comment">// Source filename</span> +00798 node->File = sourceFile; +00799 +00800 <span class="comment">// Source line</span> +00801 node->Line = <a class="code" href="a05377.html#a3">line</a>; +00802 +00803 <span class="comment">// Allocate count</span> +00804 node->AllocateNumber = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr0">_AllocateCount</a>++; +00805 +00806 <span class="comment">// End magic number aligned on new size</span> +00807 node->EndMagicNumber = (<a class="code" href="a04558.html#a11">uint32</a>*)((<a class="code" href="a04558.html#a7">uint8</a>*)node + <a class="code" href="a04223.html#a587">size</a> + <span class="keyword">sizeof</span> (CNodeBegin)); +00808 +00809 <span class="comment">// Uninitialised memory</span> +00810 memset ((<a class="code" href="a04558.html#a7">uint8</a>*)node + <span class="keyword">sizeof</span>(CNodeBegin), UninitializedMemory, (<a class="code" href="a04558.html#a11">uint32</a>)(node->EndMagicNumber) - ( (<a class="code" href="a04558.html#a11">uint32</a>)node + <span class="keyword">sizeof</span>(CNodeBegin) ) ); +00811 +00812 <span class="comment">// Crc node</span> +00813 <a class="code" href="a04356.html#a1">NL_UPDATE_MAGIC_NUMBER</a> (node); +00814 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00815 <span class="preprocessor"></span> +00816 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord13">leaveCriticalSectionSB</a> (); +00817 +00818 <span class="comment">// Return the user pointer</span> +00819 <span class="keywordflow">return</span> (<span class="keywordtype">void</span>*)((<a class="code" href="a04558.html#a15">uint</a>)node + <span class="keyword">sizeof</span> (CNodeBegin)); +00820 } +00821 <span class="keywordflow">else</span> +00822 { +00823 <span class="comment">// *******************</span> +00824 <span class="comment">// Large block</span> +00825 <span class="comment">// *******************</span> +00826 +00827 <span class="comment">// Check size</span> +00828 <span class="keywordflow">if</span> ( (<a class="code" href="a04223.html#a587">size</a> & ~CNodeBegin::SizeMask) != 0) +00829 { +00830 <span class="comment">// ********</span> +00831 <span class="comment">// * STOP *</span> +00832 <span class="comment">// ********</span> +00833 <span class="comment">// * Attempt to allocate more than 1 Go</span> +00834 <span class="comment">// ********</span> +00835 <a class="code" href="a04356.html#a3">NL_ALLOC_STOP</a>; +00836 +00837 <span class="comment">// Select outofmemory mode</span> +00838 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr10">_OutOfMemoryMode</a> == <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw18NLMISC_1_1CHeapAllocatorw11">ReturnNull</a>) +00839 <span class="keywordflow">return</span> NULL; +00840 <span class="keywordflow">else</span> +00841 <span class="keywordflow">throw</span> std::bad_alloc(); +00842 } +00843 +00844 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord4">enterCriticalSectionLB</a> (); +00845 +00846 <span class="comment">// Find a free node</span> +00847 CHeapAllocator::CFreeNode *freeNode = CHeapAllocator::find (size); +00848 +00849 <span class="comment">// The node</span> +00850 CNodeBegin *node; +00851 +00852 <span class="comment">// Node not found ?</span> +00853 <span class="keywordflow">if</span> (freeNode == NULL) +00854 { +00855 <span class="comment">// Block allocation mode</span> +00856 <span class="keywordflow">if</span> ((<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr2">_BlockAllocationMode</a> == <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw15NLMISC_1_1CHeapAllocatorw4">DontGrow</a>) && (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr5">_MainBlockList</a> != NULL)) +00857 { +00858 <span class="comment">// Select outofmemory mode</span> +00859 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr10">_OutOfMemoryMode</a> == <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw18NLMISC_1_1CHeapAllocatorw11">ReturnNull</a>) +00860 <span class="keywordflow">return</span> NULL; +00861 <span class="keywordflow">else</span> +00862 <span class="keywordflow">throw</span> std::bad_alloc(); +00863 } +00864 +00865 <span class="comment">// The node</span> +00866 <a class="code" href="a04558.html#a7">uint8</a> *<a class="code" href="a04223.html#a589">buffer</a>; +00867 +00868 <span class="comment">// Alloc size</span> +00869 <a class="code" href="a04558.html#a15">uint</a> allocSize; +00870 +00871 <span class="comment">// Aligned size</span> +00872 <a class="code" href="a04558.html#a15">uint</a> allignedSize = (<a class="code" href="a04223.html#a587">size</a>&~(<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatory1NLMISC_1_1CHeapAllocatory3">Align</a>-1)) + (( (<a class="code" href="a04223.html#a587">size</a>&(<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatory1NLMISC_1_1CHeapAllocatory3">Align</a>-1))==0 ) ? 0 : <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatory1NLMISC_1_1CHeapAllocatory3">Align</a>); +00873 <span class="keywordflow">if</span> (allignedSize < <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatory1NLMISC_1_1CHeapAllocatory4">BlockDataSizeMin</a>) +00874 allignedSize = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatory1NLMISC_1_1CHeapAllocatory4">BlockDataSizeMin</a>; +00875 +00876 <span class="comment">// Does the node bigger than mainNodeSize ?</span> +00877 <span class="keywordflow">if</span> (allignedSize > (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr6">_MainBlockSize</a>-<span class="keyword">sizeof</span> (CNodeBegin)-<a class="code" href="a04354.html#a2">NL_HEAP_NODE_END_SIZE</a>)) +00878 <span class="comment">// Allocate a specific block</span> +00879 allocSize = allignedSize + <span class="keyword">sizeof</span> (CNodeBegin) + <a class="code" href="a04354.html#a2">NL_HEAP_NODE_END_SIZE</a>; +00880 <span class="keywordflow">else</span> +00881 <span class="comment">// Allocate a new block</span> +00882 allocSize = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr6">_MainBlockSize</a>; +00883 +00884 <span class="comment">// Allocate the buffer</span> +00885 <a class="code" href="a04223.html#a589">buffer</a> = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatora1">allocateBlock</a> (allocSize+Align); +00886 +00887 <span class="comment">// Add the buffer</span> +00888 CMainBlock *mainBlock = (CMainBlock*)<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatora1">allocateBlock</a> (<span class="keyword">sizeof</span>(CMainBlock)); +00889 mainBlock->Size = allocSize+<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatory1NLMISC_1_1CHeapAllocatory3">Align</a>; +00890 mainBlock->Ptr = <a class="code" href="a04223.html#a589">buffer</a>; +00891 mainBlock->Next = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr5">_MainBlockList</a>; +00892 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr5">_MainBlockList</a> = mainBlock; +00893 +00894 <span class="comment">// Init the new block</span> +00895 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord8">initEmptyBlock</a> (*mainBlock); +00896 +00897 <span class="comment">// Get the first node</span> +00898 node = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode</a> (mainBlock); +00899 } +00900 <span class="keywordflow">else</span> +00901 { +00902 <span class="comment">// Get the node</span> +00903 node = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh9">getNode</a> (freeNode); +00904 +00905 <span class="comment">// Remove the node from free blocks and get the removed block</span> +00906 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord6">erase</a> (freeNode); +00907 } +00908 +00909 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00910 <span class="preprocessor"></span> <span class="comment">// Check the node CRC</span> +00911 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord1">checkNode</a> (node, evalMagicNumber (node)); +00912 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00913 <span class="preprocessor"></span> +00914 <span class="comment">// Split the node</span> +00915 CNodeBegin *rest = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord16">splitNode</a> (node, size); +00916 +00917 <span class="comment">// Fill informations for the first part of the node</span> +00918 +00919 <span class="comment">// Clear free flag</span> +00920 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh24">setNodeUsed</a> (node); +00921 +00922 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00923 <span class="preprocessor"></span> <span class="comment">// Fill category</span> +00924 strncpy (node->Category, category, CategoryStringLength-1); +00925 +00926 <span class="comment">// Source filename</span> +00927 node->File = sourceFile; +00928 +00929 <span class="comment">// Source line</span> +00930 node->Line = <a class="code" href="a05377.html#a3">line</a>; +00931 +00932 <span class="comment">// Allocate count</span> +00933 node->AllocateNumber = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr0">_AllocateCount</a>++; +00934 +00935 <span class="comment">// Crc node</span> +00936 <a class="code" href="a04356.html#a1">NL_UPDATE_MAGIC_NUMBER</a> (node); +00937 +00938 <span class="comment">// Uninitialised memory</span> +00939 memset ((<a class="code" href="a04558.html#a7">uint8</a>*)node + <span class="keyword">sizeof</span>(CNodeBegin), UninitializedMemory, (<a class="code" href="a04558.html#a11">uint32</a>)(node->EndMagicNumber) - ( (<a class="code" href="a04558.html#a11">uint32</a>)node + <span class="keyword">sizeof</span>(CNodeBegin) ) ); +00940 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00941 <span class="preprocessor"></span> +00942 <span class="comment">// Node has been splited ?</span> +00943 <span class="keywordflow">if</span> (rest) +00944 { +00945 <span class="comment">// Fill informations for the second part of the node</span> +00946 +00947 <span class="comment">// Get the freeNode</span> +00948 freeNode = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh5">getFreeNode</a> (rest); +00949 +00950 <span class="comment">// Insert the free node</span> +00951 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord9">insert</a> (freeNode); +00952 +00953 <span class="comment">// Crc node</span> +00954 <a class="code" href="a04356.html#a1">NL_UPDATE_MAGIC_NUMBER</a> (rest); +00955 } +00956 +00957 <span class="comment">// Check the node size</span> +00958 <a class="code" href="a04356.html#a0">internalAssert</a> ( size <= getNodeSize (node) ); +00959 <a class="code" href="a04356.html#a0">internalAssert</a> ( std::max ((<a class="code" href="a04558.html#a15">uint</a>)BlockDataSizeMin, size + (uint)Align) + <span class="keyword">sizeof</span> (CNodeBegin) + <span class="keyword">sizeof</span> (CNodeEnd) + <span class="keyword">sizeof</span> (CNodeBegin) + <span class="keyword">sizeof</span> (CNodeEnd) + BlockDataSizeMin >= getNodeSize (node) ); +00960 +00961 <span class="comment">// Check pointer alignment</span> +00962 <a class="code" href="a04356.html#a0">internalAssert</a> (((<a class="code" href="a04558.html#a11">uint32</a>)node&(Align-1)) == 0); +00963 <a class="code" href="a04356.html#a0">internalAssert</a> (((<a class="code" href="a04558.html#a11">uint32</a>)((<span class="keywordtype">char</span>*)node + <span class="keyword">sizeof</span>(CNodeBegin))&(Align-1)) == 0); +00964 +00965 <span class="comment">// Check size</span> +00966 <a class="code" href="a04356.html#a0">internalAssert</a> ((<a class="code" href="a04558.html#a11">uint32</a>)node->EndMagicNumber <= (<a class="code" href="a04558.html#a11">uint32</a>)((<a class="code" href="a04558.html#a7">uint8</a>*)node+<span class="keyword">sizeof</span>(CNodeBegin)+<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (node) )); +00967 <a class="code" href="a04356.html#a0">internalAssert</a> ((uint32)node->EndMagicNumber > (uint32)(((uint8*)node+<span class="keyword">sizeof</span>(CNodeBegin)+<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (node) ) - BlockDataSizeMin - BlockDataSizeMin - <span class="keyword">sizeof</span>(CNodeBegin) - <span class="keyword">sizeof</span>(CNodeEnd))); +00968 +00969 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord12">leaveCriticalSectionLB</a> (); +00970 +00971 <span class="comment">// Return the user pointer</span> +00972 <span class="keywordflow">return</span> (<span class="keywordtype">void</span>*)((<a class="code" href="a04558.html#a15">uint</a>)node + <span class="keyword">sizeof</span> (CNodeBegin)); +00973 } +00974 } +00975 <span class="keywordflow">else</span> +00976 { +00977 <span class="comment">// ********</span> +00978 <span class="comment">// * STOP *</span> +00979 <span class="comment">// ********</span> +00980 <span class="comment">// * Attempt to allocate 0 bytes</span> +00981 <span class="comment">// ********</span> +00982 <a class="code" href="a04356.html#a3">NL_ALLOC_STOP</a>; +00983 <span class="keywordflow">return</span> NULL; +00984 } +00985 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora1" doxytag="NLMISC::CHeapAllocator::allocateBlock" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a7">uint8</a> * NLMISC::CHeapAllocator::allocateBlock </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname1" valign="top" nowrap> <em>size</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [virtual]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l02059">2059</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05646.html#l00645">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>02060 { +02061 <span class="preprocessor">#undef malloc</span> +02062 <span class="preprocessor"></span> <span class="keywordflow">return</span> (<a class="code" href="a04558.html#a7">uint8</a>*)::malloc (<a class="code" href="a04223.html#a587">size</a>); +02063 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatord0" doxytag="NLMISC::CHeapAllocator::checkFreeNode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CHeapAllocator::checkFreeNode </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02613.html">CFreeNode</a> * </td> + <td class="mdname" nowrap> <em>current</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>stopOnError</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>recurse</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l02074">internalCheckHeap()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora3" doxytag="NLMISC::CHeapAllocator::checkHeap" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CHeapAllocator::checkHeap </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">bool </td> + <td class="mdname1" valign="top" nowrap> <em>stopOnError</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l02050">2050</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05776.html#l02074">internalCheckHeap()</a>, and <a class="el" href="a05646.html#l01119">res</a>. +<p> +<div class="fragment"><pre>02051 { +02052 <span class="keywordtype">bool</span> <a class="code" href="a04223.html#a643">res</a> = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord10">internalCheckHeap</a> (stopOnError); +02053 +02054 <span class="keywordflow">return</span> <a class="code" href="a04223.html#a643">res</a>; +02055 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatord1" doxytag="NLMISC::CHeapAllocator::checkNode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::checkNode </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname" nowrap> <em>current</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname" nowrap> <em>crc</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l02214">2214</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05778.html#l00248">NLMISC::CHeapAllocator::CNodeBegin::EndMagicNumber</a>, <a class="el" href="a05778.html#l00247">NLMISC::CHeapAllocator::CNodeBegin::Heap</a>, <a class="el" href="a05779.html#l00060">NL_ALLOC_STOP</a>, and <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +Referenced by <a class="el" href="a05776.html#l01916">debugReportMemoryLeak()</a>, <a class="el" href="a05776.html#l00989">free()</a>, <a class="el" href="a05776.html#l01181">getAllocatedMemory()</a>, and <a class="el" href="a05776.html#l01685">getFreeMemory()</a>. +<p> +<div class="fragment"><pre>02215 { +02216 <span class="comment">// Check the bottom CRC of the node </span> +02217 <span class="keywordflow">if</span> (crc != *(node->EndMagicNumber)) +02218 { +02219 <span class="comment">// ********</span> +02220 <span class="comment">// * STOP *</span> +02221 <span class="comment">// ********</span> +02222 <span class="comment">// * The bottom CRC32 of the current node is wrong. Use checkMemory() to debug the heap.</span> +02223 <span class="comment">// ********</span> +02224 <span class="comment">// * (*node) Check for more informations</span> +02225 <span class="comment">// ********</span> +02226 <a class="code" href="a04356.html#a3">NL_ALLOC_STOP</a>; +02227 } +02228 +02229 <span class="comment">// Check the node is hold by this heap</span> +02230 <span class="keywordflow">if</span> (node->Heap != <span class="keyword">this</span>) +02231 { +02232 <span class="comment">// ********</span> +02233 <span class="comment">// * STOP *</span> +02234 <span class="comment">// ********</span> +02235 <span class="comment">// * This node is not hold by this heap. It has been allocated with another heap.</span> +02236 <span class="comment">// ********</span> +02237 <span class="comment">// * (*node) Check for more informations</span> +02238 <span class="comment">// ********</span> +02239 <a class="code" href="a04356.html#a3">NL_ALLOC_STOP</a>; +02240 } +02241 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatord2" doxytag="NLMISC::CHeapAllocator::checkNodeLB" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CHeapAllocator::checkNodeLB </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02615.html">CMainBlock</a> * </td> + <td class="mdname" nowrap> <em>mainBlock</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname" nowrap> <em>previous</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname" nowrap> <em>current</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname" nowrap> <em>next</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>stopOnError</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l02074">internalCheckHeap()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorz1952_1" doxytag="NLMISC::CHeapAllocator::checkNodeSB" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CHeapAllocator::checkNodeSB </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02625.html">CSmallBlockPool</a> * </td> + <td class="mdname" nowrap> <em>mainBlock</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname" nowrap> <em>previous</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname" nowrap> <em>current</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname" nowrap> <em>next</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>stopOnError</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l02074">internalCheckHeap()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh0" doxytag="NLMISC::CHeapAllocator::computeCRC32" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::computeCRC32 </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a11">uint32</a> & </td> + <td class="mdname" nowrap> <em>crc</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const void * </td> + <td class="mdname" nowrap> <em>buffer</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>unsigned int </td> + <td class="mdname" nowrap> <em>count</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [inline, static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora4" doxytag="NLMISC::CHeapAllocator::debugAlwaysCheckMemory" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::debugAlwaysCheckMemory </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">bool </td> + <td class="mdname1" valign="top" nowrap> <em>alwaysCheck</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l02143">2143</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +<div class="fragment"><pre>02144 { +02145 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr1">_AlwaysCheck</a> = alwaysCheck; +02146 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora5" doxytag="NLMISC::CHeapAllocator::debugGetAllocatedMemoryByCategory" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NLMISC::CHeapAllocator::debugGetAllocatedMemoryByCategory </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const char * </td> + <td class="mdname1" valign="top" nowrap> <em>category</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l01245">1245</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05778.html#l00245">NLMISC::CHeapAllocator::CNodeBegin::Category</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_6">getSmallBlock()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh16">isNodeUsed()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection()</a>, <a class="el" href="a05778.html#l00307">NLMISC::CHeapAllocator::CMainBlock::Next</a>, <a class="el" href="a05778.html#l00425">NLMISC::CHeapAllocator::CSmallBlockPool::Next</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>01246 { +01247 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection</a> (); +01248 +01249 <span class="comment">// Sum allocated memory</span> +01250 <a class="code" href="a04558.html#a15">uint</a> memory = 0; +01251 +01252 <span class="comment">// For each small block</span> +01253 CSmallBlockPool *currentSB = (CSmallBlockPool *)<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_4">_SmallBlockPool</a>; +01254 <span class="keywordflow">while</span> (currentSB) +01255 { +01256 <span class="comment">// For each node in this small block pool</span> +01257 <a class="code" href="a04558.html#a15">uint</a> block; +01258 <span class="keywordflow">for</span> (block=0; block<<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw14">SmallBlockPoolSize</a>; block++) +01259 { +01260 <span class="comment">// Get the node</span> +01261 <span class="keyword">const</span> CNodeBegin *current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_6">getSmallBlock</a> (currentSB, block); +01262 +01263 <span class="comment">// Node allocated ?</span> +01264 <span class="keywordflow">if</span> ((<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh16">isNodeUsed</a> (current)) && (strcmp (current->Category, category)==0)) +01265 memory += <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (current); +01266 +01267 memory += <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (current); +01268 } +01269 +01270 <span class="comment">// Next block</span> +01271 currentSB = currentSB->Next; +01272 } +01273 +01274 <span class="comment">// For each main block</span> +01275 CMainBlock *currentBlock = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr5">_MainBlockList</a>; +01276 <span class="keywordflow">while</span> (currentBlock) +01277 { +01278 <span class="comment">// Get the first node</span> +01279 <span class="keyword">const</span> CNodeBegin *current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode</a> (currentBlock); +01280 <span class="keywordflow">while</span> (current) +01281 { +01282 <span class="comment">// Node allocated ?</span> +01283 <span class="keywordflow">if</span> ((<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh16">isNodeUsed</a> (current)) && (strcmp (current->Category, category)==0)) +01284 memory += <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (current); +01285 +01286 <span class="comment">// Next node</span> +01287 current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode</a> (current); +01288 } +01289 +01290 <span class="comment">// Next block</span> +01291 currentBlock = currentBlock->Next; +01292 } +01293 +01294 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection</a> (); +01295 +01296 <span class="comment">// Return memory used</span> +01297 <span class="keywordflow">return</span> memory; +01298 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora6" doxytag="NLMISC::CHeapAllocator::debugGetDebugInfoSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NLMISC::CHeapAllocator::debugGetDebugInfoSize </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l01304">1304</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05776.html#l01310">debugGetLBDebugInfoSize()</a>, <a class="el" href="a05776.html#l01342">debugGetSBDebugInfoSize()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>01305 { +01306 <span class="comment">// Return memory used</span> +01307 <span class="keywordflow">return</span> <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatora8">debugGetSBDebugInfoSize</a> () + <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatora7">debugGetLBDebugInfoSize</a> (); +01308 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora7" doxytag="NLMISC::CHeapAllocator::debugGetLBDebugInfoSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NLMISC::CHeapAllocator::debugGetLBDebugInfoSize </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l01310">1310</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection()</a>, <a class="el" href="a05778.html#l00307">NLMISC::CHeapAllocator::CMainBlock::Next</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a05776.html#l01304">debugGetDebugInfoSize()</a>. +<p> +<div class="fragment"><pre>01311 { +01312 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection</a> (); +01313 +01314 <span class="comment">// Sum memory used by debug header</span> +01315 <a class="code" href="a04558.html#a15">uint</a> memory = 0; +01316 +01317 <span class="comment">// For each main block</span> +01318 CMainBlock *currentBlock = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr5">_MainBlockList</a>; +01319 <span class="keywordflow">while</span> (currentBlock) +01320 { +01321 <span class="comment">// Get the first node</span> +01322 <span class="keyword">const</span> CNodeBegin *current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode</a> (currentBlock); +01323 <span class="keywordflow">while</span> (current) +01324 { +01325 <span class="comment">// Node allocated ?</span> +01326 memory += <span class="keyword">sizeof</span>(CNodeBegin) - <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw10">ReleaseHeaderSize</a> + <span class="keyword">sizeof</span>(CNodeEnd); +01327 +01328 <span class="comment">// Next node</span> +01329 current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode</a> (current); +01330 } +01331 +01332 <span class="comment">// Next block</span> +01333 currentBlock = currentBlock->Next; +01334 } +01335 +01336 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection</a> (); +01337 +01338 <span class="comment">// Return memory used</span> +01339 <span class="keywordflow">return</span> memory; +01340 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora8" doxytag="NLMISC::CHeapAllocator::debugGetSBDebugInfoSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NLMISC::CHeapAllocator::debugGetSBDebugInfoSize </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l01342">1342</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection()</a>, <a class="el" href="a05778.html#l00425">NLMISC::CHeapAllocator::CSmallBlockPool::Next</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a05776.html#l01304">debugGetDebugInfoSize()</a>. +<p> +<div class="fragment"><pre>01343 { +01344 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection</a> (); +01345 +01346 <span class="comment">// Sum memory used by debug header</span> +01347 <a class="code" href="a04558.html#a15">uint</a> memory = 0; +01348 +01349 <span class="comment">// For each small blocks</span> +01350 CSmallBlockPool *pool = (CSmallBlockPool*)<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_4">_SmallBlockPool</a>; +01351 <span class="keywordflow">while</span> (pool) +01352 { +01353 memory += <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw14">SmallBlockPoolSize</a> * (<span class="keyword">sizeof</span>(CNodeBegin) - <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw10">ReleaseHeaderSize</a> + <span class="keyword">sizeof</span>(CNodeEnd)); +01354 +01355 <span class="comment">// Next pool</span> +01356 pool = pool->Next; +01357 } +01358 +01359 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection</a> (); +01360 +01361 <span class="comment">// Return memory used</span> +01362 <span class="keywordflow">return</span> memory; +01363 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora9" doxytag="NLMISC::CHeapAllocator::debugIsAlwaysCheckMemory" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CHeapAllocator::debugIsAlwaysCheckMemory </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">bool </td> + <td class="mdname1" valign="top" nowrap> <em>alwaysCheck</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l02152">2152</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +<div class="fragment"><pre>02153 { +02154 <span class="keywordflow">return</span> <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr1">_AlwaysCheck</a>; +02155 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorz1953_0" doxytag="NLMISC::CHeapAllocator::debugPopCategoryString" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::debugPopCategoryString </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l02189">2189</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05776.html#l00989">free()</a>, <a class="el" href="a06489.html#l00066">NLMISC::CTDS::getPointer()</a>, <a class="el" href="a05778.html#l00475">NLMISC::CHeapAllocator::CCategory::Next</a>, and <a class="el" href="a06489.html#l00077">NLMISC::CTDS::setPointer()</a>. +<p> +Referenced by <a class="el" href="a05776.html#l01916">debugReportMemoryLeak()</a>, and <a class="el" href="a05776.html#l01393">debugStatisticsReport()</a>. +<p> +<div class="fragment"><pre>02190 { +02191 <span class="comment">// Get the category stack pointer</span> +02192 CCategory *last = (CCategory*)<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1953_2">_CategoryStack</a>.<a class="code" href="a03473.html#NLMISC_1_1CTDSa1">getPointer</a> (); +02193 <span class="comment">// nlassertex (last, ("(CHeapAllocator::debugPopCategoryString ()) Pop category wihtout Push"));</span> +02194 <span class="keywordflow">if</span> (last) +02195 { +02196 CCategory *next = last->Next; +02197 +02198 <span class="comment">// Free last node, no need to be thread safe here, because we use thread specifc storage</span> +02199 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatora12">free</a> (last); +02200 +02201 <span class="comment">/* Push it, no need to be thread safe here, because we use thread specifc storage */</span> +02202 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1953_2">_CategoryStack</a>.<a class="code" href="a03473.html#NLMISC_1_1CTDSa2">setPointer</a> (next); +02203 } +02204 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorz1953_1" doxytag="NLMISC::CHeapAllocator::debugPushCategoryString" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::debugPushCategoryString </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const char * </td> + <td class="mdname1" valign="top" nowrap> <em>str</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l02173">2173</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a06489.html#l00066">NLMISC::CTDS::getPointer()</a>, <a class="el" href="a05778.html#l00474">NLMISC::CHeapAllocator::CCategory::Name</a>, <a class="el" href="a05777.html#l00050">NelAlloc</a>, <a class="el" href="a05778.html#l00475">NLMISC::CHeapAllocator::CCategory::Next</a>, <a class="el" href="a05775.html#l00920">NL_HEAP_CATEGORY_BLOCK_CATEGORY</a>, and <a class="el" href="a06489.html#l00077">NLMISC::CTDS::setPointer()</a>. +<p> +Referenced by <a class="el" href="a05776.html#l01916">debugReportMemoryLeak()</a>, and <a class="el" href="a05776.html#l01393">debugStatisticsReport()</a>. +<p> +<div class="fragment"><pre>02174 { +02175 <span class="comment">// Get the category stack pointer</span> +02176 CCategory *last = (CCategory*)<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1953_2">_CategoryStack</a>.<a class="code" href="a03473.html#NLMISC_1_1CTDSa1">getPointer</a> (); +02177 +02178 <span class="comment">// New category node</span> +02179 CCategory *_new = (CCategory *)<a class="code" href="a04354.html#a0">NelAlloc</a> (*<span class="keyword">this</span>, <span class="keyword">sizeof</span>(CCategory), NL_HEAP_CATEGORY_BLOCK_CATEGORY); +02180 _new->Name = str; +02181 _new->Next = last; +02182 +02183 <span class="comment">/* Push it, no need to be thread safe here, because we use thread specifc storage */</span> +02184 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1953_2">_CategoryStack</a>.<a class="code" href="a03473.html#NLMISC_1_1CTDSa2">setPointer</a> (_new); +02185 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora10" doxytag="NLMISC::CHeapAllocator::debugReportMemoryLeak" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::debugReportMemoryLeak </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l01916">1916</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05776.html#l00059">NLMISC::CHeapAllocatorOutputError()</a>, <a class="el" href="a05776.html#l02214">checkNode()</a>, <a class="el" href="a05776.html#l02189">debugPopCategoryString()</a>, <a class="el" href="a05776.html#l02173">debugPushCategoryString()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_6">getSmallBlock()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh16">isNodeUsed()</a>, <a class="el" href="a05778.html#l00425">NLMISC::CHeapAllocator::CSmallBlockPool::Next</a>, <a class="el" href="a05778.html#l00307">NLMISC::CHeapAllocator::CMainBlock::Next</a>, <a class="el" href="a05775.html#l00921">NL_HEAP_MEM_DEBUG_CATEGORY</a>, <a class="el" href="a06331.html#l00081">NLMISC::report()</a>, <a class="el" href="a05586.html#l00161">NLMISC::smprintf()</a>, <a class="el" href="a05776.html#l01914">NLMISC::TLinkMap</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>01917 { +01918 <span class="comment">// enterCriticalSection ();</span> +01919 +01920 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1953_1">debugPushCategoryString</a> (NL_HEAP_MEM_DEBUG_CATEGORY); +01921 +01922 <span class="comment">// Sum allocated memory</span> +01923 <a class="code" href="a04558.html#a15">uint</a> memory = 0; +01924 +01925 <span class="comment">// Leak map</span> +01926 <a class="code" href="a05378.html#a27">TLinkMap</a> leakMap; +01927 +01928 <span class="comment">// Header</span> +01929 <span class="keywordtype">char</span> <a class="code" href="a05378.html#a354">report</a>[2048]; +01930 <a class="code" href="a05378.html#a259">smprintf</a> (report, 2048, <span class="stringliteral">"Report Memory leak for allocator \"%s\"\n"</span>, _Name); +01931 <a class="code" href="a05378.html#a327">CHeapAllocatorOutputError</a> (report); +01932 +01933 <span class="comment">// For each small block</span> +01934 CMainBlock *currentBlock = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr5">_MainBlockList</a>; +01935 <span class="keywordflow">while</span> (currentBlock) +01936 { +01937 <span class="comment">// Get the first node</span> +01938 <span class="keyword">const</span> CNodeBegin *current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode</a> (currentBlock); +01939 <span class="keywordflow">while</span> (current) +01940 { +01941 <span class="comment">// Check node</span> +01942 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord1">checkNode</a> (current, evalMagicNumber (current)); +01943 +01944 <span class="comment">// Node allocated ?</span> +01945 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh16">isNodeUsed</a> (current) && ( (current->Category == NULL) || (current->Category[0] != <span class="charliteral">'_'</span>)) ) +01946 { +01947 <span class="comment">// Make a report</span> +01948 <a class="code" href="a05378.html#a259">smprintf</a> (report, 2048, <span class="stringliteral">"%s(%d)\t: \"%s\""</span>, current->File, current->Line, current->Category); +01949 +01950 <span class="comment">// Look for this leak</span> +01951 TLinkMap::iterator ite = leakMap.find (report); +01952 +01953 <span class="comment">// Not found ?</span> +01954 <span class="keywordflow">if</span> (ite == leakMap.end ()) +01955 { +01956 ite = leakMap.insert (TLinkMap::value_type (report, CLeak ())).first; +01957 ite->second.Count = 0; +01958 ite->second.Memory = 0; +01959 } +01960 +01961 <span class="comment">// One more leak</span> +01962 ite->second.Count++; +01963 ite->second.Memory += <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (current); +01964 +01965 memory += <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (current); +01966 } +01967 +01968 <span class="comment">// Next node</span> +01969 current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode</a> (current); +01970 } +01971 +01972 <span class="comment">// Next block</span> +01973 currentBlock = currentBlock->Next; +01974 } +01975 +01976 <span class="comment">// For each small block</span> +01977 CSmallBlockPool *currentSB = (CSmallBlockPool *)<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_4">_SmallBlockPool</a>; +01978 <span class="keywordflow">while</span> (currentSB) +01979 { +01980 <span class="comment">// For each node in this small block pool</span> +01981 <a class="code" href="a04558.html#a15">uint</a> block; +01982 <span class="keywordflow">for</span> (block=0; block<<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw14">SmallBlockPoolSize</a>; block++) +01983 { +01984 <span class="comment">// Get the node</span> +01985 <span class="keyword">const</span> CNodeBegin *current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_6">getSmallBlock</a> (currentSB, block); +01986 <span class="comment">// Check node</span> +01987 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord1">checkNode</a> (current, evalMagicNumber (current)); +01988 +01989 <span class="comment">// Node allocated ?</span> +01990 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh16">isNodeUsed</a> (current) && ( (current->Category == NULL) || (current->Category[0] != <span class="charliteral">'_'</span>)) ) +01991 { +01992 <span class="comment">// Make a report</span> +01993 <a class="code" href="a05378.html#a259">smprintf</a> (report, 2048, <span class="stringliteral">"%s(%d)\t: \"%s\""</span>, current->File, current->Line, current->Category); +01994 +01995 <span class="comment">// Look for this leak</span> +01996 TLinkMap::iterator ite = leakMap.find (report); +01997 +01998 <span class="comment">// Not found ?</span> +01999 <span class="keywordflow">if</span> (ite == leakMap.end ()) +02000 { +02001 ite = leakMap.insert (TLinkMap::value_type (report, CLeak ())).first; +02002 ite->second.Count = 0; +02003 ite->second.Memory = 0; +02004 } +02005 +02006 <span class="comment">// One more leak</span> +02007 ite->second.Count++; +02008 ite->second.Memory += <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (current); +02009 +02010 memory += <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (current); +02011 } +02012 } +02013 +02014 <span class="comment">// Next block</span> +02015 currentSB = currentSB->Next; +02016 } +02017 +02018 <span class="comment">// Look for this leak</span> +02019 TLinkMap::iterator ite = leakMap.begin (); +02020 <span class="keywordflow">while</span> (ite != leakMap.end ()) +02021 { +02022 <span class="comment">// Make a report</span> +02023 <a class="code" href="a05378.html#a259">smprintf</a> (report, 2048, <span class="stringliteral">"%s,\tLeak count : %d,\tMemory allocated : %d\n"</span>, ite->first.c_str (), ite->second.Count, ite->second.Memory); +02024 +02025 <span class="comment">// Report on stderr</span> +02026 <a class="code" href="a05378.html#a327">CHeapAllocatorOutputError</a> (report); +02027 +02028 ite++; +02029 } +02030 +02031 <span class="comment">// Make a report</span> +02032 <span class="keywordflow">if</span> (memory) +02033 { +02034 <a class="code" href="a05378.html#a259">smprintf</a> (report, 2048, <span class="stringliteral">"%d byte(s) found\n"</span>, memory); +02035 } +02036 <span class="keywordflow">else</span> +02037 { +02038 <a class="code" href="a05378.html#a259">smprintf</a> (report, 2048, <span class="stringliteral">"No memory leak\n"</span>); +02039 } +02040 <a class="code" href="a05378.html#a327">CHeapAllocatorOutputError</a> (report); +02041 +02042 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1953_0">debugPopCategoryString</a> (); +02043 +02044 <span class="comment">// leaveCriticalSection ();</span> +02045 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora11" doxytag="NLMISC::CHeapAllocator::debugStatisticsReport" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CHeapAllocator::debugStatisticsReport </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const char * </td> + <td class="mdname" nowrap> <em>stateFile</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>memoryMap</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l01393">1393</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05778.html#l00245">NLMISC::CHeapAllocator::CNodeBegin::Category</a>, <a class="el" href="a05646.html#l00240">count</a>, <a class="el" href="a05776.html#l02189">debugPopCategoryString()</a>, <a class="el" href="a05776.html#l02173">debugPushCategoryString()</a>, <a class="el" href="a05538.html#l02654">file</a>, <a class="el" href="a05776.html#l02269">getAllocatedSystemMemory()</a>, <a class="el" href="a05776.html#l02340">getAllocatedSystemMemoryByAllocator()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_6">getSmallBlock()</a>, <a class="el" href="a05646.html#l00225">index</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh12">isNodeFree()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh16">isNodeUsed()</a>, <a class="el" href="a05778.html#l00307">NLMISC::CHeapAllocator::CMainBlock::Next</a>, <a class="el" href="a05778.html#l00425">NLMISC::CHeapAllocator::CSmallBlockPool::Next</a>, <a class="el" href="a05775.html#l00921">NL_HEAP_MEM_DEBUG_CATEGORY</a>, <a class="el" href="a05777.html#l00324">NL_HEAP_NODE_END_SIZE</a>, <a class="el" href="a05777.html#l00502">NL_SIZE_TO_SMALLBLOCK_INDEX</a>, <a class="el" href="a05777.html#l00501">NL_SMALLBLOCK_COUNT</a>, <a class="el" href="a05778.html#l00424">NLMISC::CHeapAllocator::CSmallBlockPool::Size</a>, <a class="el" href="a05646.html#l00645">size</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>01394 { +01395 <span class="comment">// Status</span> +01396 <span class="keywordtype">bool</span> status = <span class="keyword">false</span>; +01397 +01398 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1953_1">debugPushCategoryString</a> (NL_HEAP_MEM_DEBUG_CATEGORY); +01399 +01400 <span class="comment">// Open files</span> +01401 FILE *<a class="code" href="a04115.html#a95">file</a> = fopen (stateFile, <span class="stringliteral">"wt"</span>); +01402 +01403 <span class="comment">// Block map</span> +01404 <span class="keyword">typedef</span> std::map<std::string, CCategoryMap> TBlockMap; +01405 TBlockMap blockMap; +01406 +01407 <span class="comment">// Both OK</span> +01408 <span class="keywordflow">if</span> (<a class="code" href="a04115.html#a95">file</a>) +01409 { +01410 <span class="comment">// **************************</span> +01411 +01412 <span class="comment">// For each small block</span> +01413 <a class="code" href="a04558.html#a15">uint</a> smallBlockCount = 0; +01414 <a class="code" href="a04558.html#a15">uint</a> largeBlockCount = 0; +01415 CSmallBlockPool *currentSB = (CSmallBlockPool *)<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_4">_SmallBlockPool</a>; +01416 <span class="keywordflow">while</span> (currentSB) +01417 { +01418 <span class="comment">// For each node in this small block pool</span> +01419 <a class="code" href="a04558.html#a15">uint</a> block; +01420 <span class="keywordflow">for</span> (block=0; block<<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw14">SmallBlockPoolSize</a>; block++) +01421 { +01422 <span class="comment">// Get the node</span> +01423 <span class="keyword">const</span> CNodeBegin *current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_6">getSmallBlock</a> (currentSB, block); +01424 +01425 <span class="comment">// Node allocated ?</span> +01426 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh16">isNodeUsed</a> (current)) +01427 { +01428 <span class="comment">// Find the node</span> +01429 TBlockMap::iterator ite = blockMap.find ((<span class="keyword">const</span> <span class="keywordtype">char</span>*)current->Category); +01430 +01431 <span class="comment">// Found ?</span> +01432 <span class="keywordflow">if</span> (ite == blockMap.end ()) +01433 { +01434 ite = blockMap.insert (TBlockMap::value_type (current->Category, CCategoryMap ())).first; +01435 } +01436 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a587">size</a> = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (current) + <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw10">ReleaseHeaderSize</a>; +01437 ite->second.BlockCount++; +01438 ite->second.Size += <a class="code" href="a04223.html#a587">size</a>; +01439 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a587">size</a> < ite->second.Min) +01440 ite->second.Min = <a class="code" href="a04223.html#a587">size</a>; +01441 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a587">size</a> > ite->second.Max) +01442 ite->second.Max = <a class="code" href="a04223.html#a587">size</a>; +01443 } +01444 +01445 <span class="comment">// Next node</span> +01446 smallBlockCount++; +01447 } +01448 +01449 <span class="comment">// Next block</span> +01450 currentSB = currentSB->Next; +01451 } +01452 +01453 <span class="comment">// For each main block</span> +01454 CMainBlock *currentBlock = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr5">_MainBlockList</a>; +01455 <span class="keywordflow">while</span> (currentBlock) +01456 { +01457 <span class="comment">// Get the first node</span> +01458 <span class="keyword">const</span> CNodeBegin *current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode</a> (currentBlock); +01459 <span class="keywordflow">while</span> (current) +01460 { +01461 <span class="comment">// Node is used ?</span> +01462 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh16">isNodeUsed</a> (current)) +01463 { +01464 <span class="comment">// Find the node</span> +01465 TBlockMap::iterator ite = blockMap.find ((<span class="keyword">const</span> <span class="keywordtype">char</span>*)current->Category); +01466 +01467 <span class="comment">// Found ?</span> +01468 <span class="keywordflow">if</span> (ite == blockMap.end ()) +01469 { +01470 ite = blockMap.insert (TBlockMap::value_type (current->Category, CCategoryMap ())).first; +01471 } +01472 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a587">size</a> = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (current) + <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw10">ReleaseHeaderSize</a>; +01473 ite->second.BlockCount++; +01474 ite->second.Size += <a class="code" href="a04223.html#a587">size</a>; +01475 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a587">size</a> < ite->second.Min) +01476 ite->second.Min = <a class="code" href="a04223.html#a587">size</a>; +01477 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a587">size</a> > ite->second.Max) +01478 ite->second.Max = <a class="code" href="a04223.html#a587">size</a>; +01479 } +01480 +01481 <span class="comment">// Next node</span> +01482 current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode</a> (current); +01483 largeBlockCount++; +01484 } +01485 +01486 <span class="comment">// Next block</span> +01487 currentBlock = currentBlock->Next; +01488 } +01489 +01490 <span class="comment">// Write the heap info file</span> +01491 fprintf (file, <span class="stringliteral">"HEAP STATISTICS\n"</span>); +01492 fprintf (file, <span class="stringliteral">"HEAP, TOTAL MEMORY USED, ALLOCATED MEMORY, FREE MEMORY, FRAGMENTATION RATIO, MAIN BLOCK SIZE, MAIN BLOCK COUNT\n"</span>); +01493 +01494 fprintf (file, <span class="stringliteral">"%s, %d, %d, %d, %f%%, %d, %d\n"</span>, _Name, getTotalMemoryUsed (), +01495 getAllocatedMemory (), getFreeMemory (), 100.f*getFragmentationRatio (), getMainBlockSize (), getMainBlockCount ()); +01496 +01497 fprintf (file, <span class="stringliteral">"\n\nHEAP BLOCKS\n"</span>); +01498 fprintf (file, <span class="stringliteral">"SMALL BLOCK MEMORY, SMALL BLOCK COUNT, LARGE BLOCK COUNT\n"</span>); +01499 +01500 fprintf (file, <span class="stringliteral">"%d, %d, %d\n"</span>, getSmallBlockMemory (), smallBlockCount, largeBlockCount); +01501 +01502 fprintf (file, <span class="stringliteral">"\n\nHEAP DEBUG INFOS\n"</span>); +01503 fprintf (file, <span class="stringliteral">"SB DEBUG INFO, LB DEBUG INFO, TOTAL DEBUG INFO\n"</span>); +01504 +01505 fprintf (file, <span class="stringliteral">"%d, %d, %d\n"</span>, debugGetSBDebugInfoSize (), debugGetLBDebugInfoSize (), debugGetDebugInfoSize ()); +01506 +01507 <span class="comment">// **************************</span> +01508 +01509 <span class="comment">// Write the system heap info file</span> +01510 <a class="code" href="a04558.html#a15">uint</a> systemMemory = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatore0">getAllocatedSystemMemory</a> (); +01511 <a class="code" href="a04558.html#a15">uint</a> nelSystemMemory = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatora16">getAllocatedSystemMemoryByAllocator</a> (); +01512 +01513 fprintf (file, <span class="stringliteral">"\n\nSYSTEM HEAP STATISTICS\n"</span>); +01514 fprintf (file, <span class="stringliteral">"TOTAL ALLOCATED MEMORY, NEL ALLOCATED MEMORY, OTHER ALLOCATED MEMORY\n"</span>); +01515 fprintf (file, <span class="stringliteral">"%d, %d, %d\n"</span>, systemMemory, nelSystemMemory, systemMemory-nelSystemMemory); +01516 +01517 <span class="comment">// Write the category map file</span> +01518 fprintf (file, <span class="stringliteral">"\n\n\nCATEGORY STATISTICS\n"</span>); +01519 fprintf (file, <span class="stringliteral">"CATEGORY, BLOCK COUNT, MEMORY ALLOCATED, MIN BLOCK SIZE, MAX BLOCK SIZE, AVERAGE BLOCK SIZE, SB COUNT 8, SB COUNT 16, SB COUNT 24, SB COUNT 32, SB COUNT 40, SB COUNT 48, SB COUNT 56, SB COUNT 64, SB COUNT 72, SB COUNT 80, SB COUNT 88, SB COUNT 96, SB COUNT 104, SB COUNT 112, SB COUNT 120, SB COUNT 128\n"</span>); +01520 +01521 TBlockMap::iterator ite = blockMap.begin(); +01522 <span class="keywordflow">while</span> (ite != blockMap.end()) +01523 { +01524 <span class="comment">// Number of small blocks</span> +01525 <a class="code" href="a04558.html#a15">uint</a> smallB[<a class="code" href="a04354.html#a3">NL_SMALLBLOCK_COUNT</a>]; +01526 +01527 <span class="comment">// Clean</span> +01528 <a class="code" href="a04558.html#a15">uint</a> smallBlock; +01529 <span class="keywordflow">for</span> (smallBlock=0; smallBlock<<a class="code" href="a04354.html#a3">NL_SMALLBLOCK_COUNT</a>; smallBlock++) +01530 { +01531 smallB[smallBlock] = 0; +01532 } +01533 +01534 <span class="comment">// Scan small block for this category</span> +01535 currentSB = (CSmallBlockPool *)<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_4">_SmallBlockPool</a>; +01536 <span class="keywordflow">while</span> (currentSB) +01537 { +01538 <span class="comment">// For each node in this small block pool</span> +01539 <a class="code" href="a04558.html#a15">uint</a> block; +01540 <span class="keywordflow">for</span> (block=0; block<SmallBlockPoolSize; block++) +01541 { +01542 <span class="comment">// Get the node</span> +01543 <span class="keyword">const</span> CNodeBegin *current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_6">getSmallBlock</a> (currentSB, block); +01544 +01545 <span class="comment">// Node allocated ?</span> +01546 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh16">isNodeUsed</a> (current)) +01547 { +01548 <span class="comment">// Good node ?</span> +01549 <span class="keywordflow">if</span> (current->Category == ite->first) +01550 { +01551 <span class="comment">// Get the small block index</span> +01552 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a566">index</a> = <a class="code" href="a04354.html#a4">NL_SIZE_TO_SMALLBLOCK_INDEX</a> (getNodeSize (current)); +01553 +01554 <span class="comment">// One more node</span> +01555 smallB[<a class="code" href="a04223.html#a566">index</a>]++; +01556 } +01557 } +01558 } +01559 +01560 <span class="comment">// Next block</span> +01561 currentSB = currentSB->Next; +01562 } +01563 +01564 <span class="comment">// Average</span> +01565 <a class="code" href="a04558.html#a15">uint</a> average = ite->second.Size / ite->second.BlockCount; +01566 +01567 <span class="comment">// Print the line</span> +01568 fprintf (file, <span class="stringliteral">"%s, %d, %d, %d, %d, %d"</span>, ite->first.c_str(), ite->second.BlockCount, ite->second.Size, +01569 ite->second.Min, ite->second.Max, average); +01570 +01571 <span class="comment">// Print small blocks</span> +01572 <span class="keywordflow">for</span> (smallBlock=0; smallBlock<<a class="code" href="a04354.html#a3">NL_SMALLBLOCK_COUNT</a>; smallBlock++) +01573 { +01574 fprintf (file, <span class="stringliteral">", %d"</span>, smallB[smallBlock]); +01575 } +01576 +01577 fprintf (file, <span class="stringliteral">"\n"</span>); +01578 +01579 ite++; +01580 } +01581 +01582 <span class="comment">// **************************</span> +01583 +01584 <span class="comment">// Write the small block statistics</span> +01585 fprintf (file, <span class="stringliteral">"\n\n\nSMALL BLOCK STATISTICS\n"</span>); +01586 fprintf (file, <span class="stringliteral">"SIZE, BLOCK COUNT, BLOCK FREE, BLOCK USED, TOTAL MEMORY USED\n"</span>); +01587 +01588 <span class="comment">// Number of small blocks</span> +01589 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a577">count</a>[<a class="code" href="a04354.html#a3">NL_SMALLBLOCK_COUNT</a>]; +01590 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatora12">free</a>[<a class="code" href="a04354.html#a3">NL_SMALLBLOCK_COUNT</a>]; +01591 +01592 <a class="code" href="a04558.html#a15">uint</a> smallBlock; +01593 <span class="keywordflow">for</span> (smallBlock=0; smallBlock<<a class="code" href="a04354.html#a3">NL_SMALLBLOCK_COUNT</a>; smallBlock++) +01594 { +01595 <a class="code" href="a04223.html#a577">count</a>[smallBlock] = 0; +01596 free[smallBlock] = 0; +01597 } +01598 +01599 <span class="comment">// For each small block</span> +01600 currentSB = (CSmallBlockPool *)<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_4">_SmallBlockPool</a>; +01601 <span class="keywordflow">while</span> (currentSB) +01602 { +01603 <span class="comment">// For each node in this small block pool</span> +01604 <a class="code" href="a04558.html#a15">uint</a> block; +01605 <span class="keywordflow">for</span> (block=0; block<SmallBlockPoolSize; block++) +01606 { +01607 <span class="comment">// Get the node</span> +01608 <span class="keyword">const</span> CNodeBegin *current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_6">getSmallBlock</a> (currentSB, block); +01609 +01610 <span class="comment">// Get the small block index</span> +01611 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a566">index</a> = <a class="code" href="a04354.html#a4">NL_SIZE_TO_SMALLBLOCK_INDEX</a> (getNodeSize (current)); +01612 +01613 <span class="comment">// Add a block</span> +01614 <a class="code" href="a04223.html#a577">count</a>[<a class="code" href="a04223.html#a566">index</a>]++; +01615 +01616 <span class="comment">// Node allocated ?</span> +01617 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh12">isNodeFree</a> (current)) +01618 { +01619 <span class="comment">// Add a free block</span> +01620 free[<a class="code" href="a04223.html#a566">index</a>]++; +01621 } +01622 +01623 <span class="comment">// Next node</span> +01624 current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode</a> (current); +01625 } +01626 +01627 <span class="comment">// Next block</span> +01628 currentSB = currentSB->Next; +01629 } +01630 +01631 <span class="comment">// Print stats</span> +01632 <span class="keywordflow">for</span> (smallBlock=0; smallBlock<<a class="code" href="a04354.html#a3">NL_SMALLBLOCK_COUNT</a>; smallBlock++) +01633 { +01634 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a587">size</a> = (smallBlock+1)*<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw12">SmallBlockGranularity</a>; +01635 fprintf (file,<span class="stringliteral">"%d, %d, %d, %d, %d\n"</span>,size, count[smallBlock], free[smallBlock], +01636 count[smallBlock]-free[smallBlock], count[smallBlock]*(<span class="keyword">sizeof</span> (CNodeBegin) + size + NL_HEAP_NODE_END_SIZE)); +01637 } +01638 +01639 <span class="comment">// **************************</span> +01640 +01641 <span class="comment">// Write the memory map file</span> +01642 <span class="keywordflow">if</span> (memoryMap) +01643 { +01644 fprintf (file, <span class="stringliteral">"\n\n\nHEAP LARGE BLOCK DUMP\n"</span>); +01645 fprintf (file, <span class="stringliteral">"ADDRESS, SIZE, CATEGORY, HEAP, STATE, SOURCE, LINE\n"</span>); +01646 +01647 <span class="comment">// For each main block</span> +01648 currentBlock = _MainBlockList; +01649 <span class="keywordflow">while</span> (currentBlock) +01650 { +01651 <span class="comment">// Get the first node</span> +01652 <span class="keyword">const</span> CNodeBegin *current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode</a> (currentBlock); +01653 <span class="keywordflow">while</span> (current) +01654 { +01655 <span class="comment">// Write the entry</span> +01656 fprintf (file, <span class="stringliteral">"0x%08x, %d, %s, %s, %s, %s, %d\n"</span>, (<a class="code" href="a04558.html#a15">uint</a>)current + <span class="keyword">sizeof</span>(CNodeBegin), +01657 getNodeSize (current), current->Category, _Name, +01658 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh12">isNodeFree</a> (current)?<span class="stringliteral">"free"</span>:<span class="stringliteral">"used"</span>, current->File, current->Line); +01659 +01660 <span class="comment">// Next node</span> +01661 current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode</a> (current); +01662 } +01663 +01664 <span class="comment">// Next block</span> +01665 currentBlock = currentBlock->Next; +01666 } +01667 } +01668 +01669 <span class="comment">// File created successfuly</span> +01670 status = <span class="keyword">true</span>; +01671 } +01672 +01673 <span class="comment">// Close</span> +01674 <span class="keywordflow">if</span> (<a class="code" href="a04115.html#a95">file</a>) +01675 fclose (file); +01676 +01677 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1953_0">debugPopCategoryString</a> (); +01678 +01679 <span class="keywordflow">return</span> status; +01680 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatord3" doxytag="NLMISC::CHeapAllocator::enterCriticalSection" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::enterCriticalSection </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l00071">CHeapAllocator()</a>, <a class="el" href="a05776.html#l01245">debugGetAllocatedMemoryByCategory()</a>, <a class="el" href="a05776.html#l01310">debugGetLBDebugInfoSize()</a>, <a class="el" href="a05776.html#l01342">debugGetSBDebugInfoSize()</a>, <a class="el" href="a05776.html#l01845">freeAll()</a>, <a class="el" href="a05776.html#l01181">getAllocatedMemory()</a>, <a class="el" href="a05776.html#l01804">getFragmentationRatio()</a>, <a class="el" href="a05776.html#l01685">getFreeMemory()</a>, <a class="el" href="a05776.html#l01777">getSmallBlockMemory()</a>, <a class="el" href="a05776.html#l01748">getTotalMemoryUsed()</a>, <a class="el" href="a05776.html#l02074">internalCheckHeap()</a>, <a class="el" href="a05776.html#l01879">releaseMemory()</a>, and <a class="el" href="a05776.html#l02160">setName()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatord4" doxytag="NLMISC::CHeapAllocator::enterCriticalSectionLB" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::enterCriticalSectionLB </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l00989">free()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatord5" doxytag="NLMISC::CHeapAllocator::enterCriticalSectionSB" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::enterCriticalSectionSB </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l00989">free()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatord6" doxytag="NLMISC::CHeapAllocator::erase" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::erase </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02613.html">CFreeNode</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>z</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l00260">260</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05778.html#l00372">NLMISC::CHeapAllocator::CNullNode::FreeNode</a>, <a class="el" href="a05779.html#l00032">internalAssert</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh11">isNodeBlack()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh14">isNodeRed()</a>, <a class="el" href="a05779.html#l00047">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord14">rotateLeft()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord15">rotateRight()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh19">setNodeColor()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh22">setNodeRed()</a>, <a class="el" href="a05646.html#l00236">w</a>, <a class="el" href="a05646.html#l00236">x</a>, <a class="el" href="a05646.html#l00236">y</a>, and <a class="el" href="a05646.html#l00236">z</a>. +<p> +Referenced by <a class="el" href="a05776.html#l00989">free()</a>. +<p> +<div class="fragment"><pre>00261 { +00262 CFreeNode *<a class="code" href="a04223.html#a572">x</a>, *<a class="code" href="a04223.html#a573">y</a>; +00263 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a574">z</a>->Left == &<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr9">_NullNode</a>.<a class="code" href="a02623.html#NLMISC_1_1CHeapAllocator_1_1CNullNodeo0">FreeNode</a> || <a class="code" href="a04223.html#a574">z</a>->Right == &<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr9">_NullNode</a>.<a class="code" href="a02623.html#NLMISC_1_1CHeapAllocator_1_1CNullNodeo0">FreeNode</a>) +00264 { +00265 <span class="comment">// y has a NULL node as a child</span> +00266 <a class="code" href="a04223.html#a573">y</a> = <a class="code" href="a04223.html#a574">z</a>; +00267 } +00268 <span class="keywordflow">else</span> +00269 { +00270 <span class="comment">// Find tree successor with a &_NullNode.FreeNode node as a child</span> +00271 <a class="code" href="a04223.html#a573">y</a> = <a class="code" href="a04223.html#a574">z</a>->Right; +00272 <span class="keywordflow">while</span> (<a class="code" href="a04223.html#a573">y</a>->Left != &<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr9">_NullNode</a>.<a class="code" href="a02623.html#NLMISC_1_1CHeapAllocator_1_1CNullNodeo0">FreeNode</a>) +00273 <a class="code" href="a04223.html#a573">y</a> = <a class="code" href="a04223.html#a573">y</a>->Left; +00274 } +00275 +00276 <span class="comment">// x is y's only child</span> +00277 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a573">y</a>->Left != &<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr9">_NullNode</a>.<a class="code" href="a02623.html#NLMISC_1_1CHeapAllocator_1_1CNullNodeo0">FreeNode</a>) +00278 <a class="code" href="a04223.html#a572">x</a> = <a class="code" href="a04223.html#a573">y</a>->Left; +00279 <span class="keywordflow">else</span> +00280 <a class="code" href="a04223.html#a572">x</a> = <a class="code" href="a04223.html#a573">y</a>->Right; +00281 +00282 <span class="comment">// Remove y from the parent chain</span> +00283 <a class="code" href="a04223.html#a572">x</a>->Parent = <a class="code" href="a04223.html#a573">y</a>->Parent; +00284 +00285 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a573">y</a>->Parent) +00286 { +00287 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a573">y</a> == <a class="code" href="a04223.html#a573">y</a>->Parent->Left) +00288 <a class="code" href="a04223.html#a573">y</a>->Parent->Left = <a class="code" href="a04223.html#a572">x</a>; +00289 <span class="keywordflow">else</span> +00290 { +00291 <a class="code" href="a04356.html#a0">internalAssert</a> (y == <a class="code" href="a04223.html#a573">y</a>->Parent->Right); +00292 <a class="code" href="a04223.html#a573">y</a>->Parent->Right = <a class="code" href="a04223.html#a572">x</a>; +00293 } +00294 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (<a class="code" href="a04223.html#a573">y</a>->Parent); +00295 } +00296 <span class="keywordflow">else</span> +00297 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr4">_FreeTreeRoot</a> = <a class="code" href="a04223.html#a572">x</a>; +00298 +00299 <span class="keywordtype">bool</span> yRed = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh14">isNodeRed</a> (y); +00300 +00301 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a573">y</a> != <a class="code" href="a04223.html#a574">z</a>) +00302 { +00303 <span class="comment">// Replace y by z</span> +00304 *<a class="code" href="a04223.html#a573">y</a> = *<a class="code" href="a04223.html#a574">z</a>; +00305 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh19">setNodeColor</a> (y, isNodeRed (z)); +00306 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a573">y</a>->Parent) +00307 { +00308 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a573">y</a>->Parent->Left == <a class="code" href="a04223.html#a574">z</a>) +00309 { +00310 <a class="code" href="a04223.html#a573">y</a>->Parent->Left = <a class="code" href="a04223.html#a573">y</a>; +00311 } +00312 <span class="keywordflow">else</span> +00313 { +00314 <a class="code" href="a04356.html#a0">internalAssert</a> (<a class="code" href="a04223.html#a573">y</a>->Parent->Right == z); +00315 <a class="code" href="a04223.html#a573">y</a>->Parent->Right = <a class="code" href="a04223.html#a573">y</a>; +00316 } +00317 } +00318 <span class="keywordflow">else</span> +00319 { +00320 <a class="code" href="a04356.html#a0">internalAssert</a> (_FreeTreeRoot == z); +00321 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr4">_FreeTreeRoot</a> = <a class="code" href="a04223.html#a573">y</a>; +00322 } +00323 +00324 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a573">y</a>->Left) +00325 { +00326 <a class="code" href="a04356.html#a0">internalAssert</a> (<a class="code" href="a04223.html#a573">y</a>->Left->Parent == z); +00327 <a class="code" href="a04223.html#a573">y</a>->Left->Parent = <a class="code" href="a04223.html#a573">y</a>; +00328 +00329 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (<a class="code" href="a04223.html#a573">y</a>->Left); +00330 } +00331 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a573">y</a>->Right) +00332 { +00333 <a class="code" href="a04356.html#a0">internalAssert</a> (<a class="code" href="a04223.html#a573">y</a>->Right->Parent == z); +00334 <a class="code" href="a04223.html#a573">y</a>->Right->Parent = <a class="code" href="a04223.html#a573">y</a>; +00335 +00336 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (<a class="code" href="a04223.html#a573">y</a>->Right); +00337 } +00338 } +00339 +00340 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (x); +00341 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (y); +00342 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a573">y</a>->Parent) +00343 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (<a class="code" href="a04223.html#a573">y</a>->Parent); +00344 +00345 <span class="keywordflow">if</span> (!yRed) +00346 { +00347 <span class="comment">// Maintain Red-Black tree balance</span> +00348 <span class="comment">// After deleting node x</span> +00349 <span class="keywordflow">while</span> (<a class="code" href="a04223.html#a572">x</a> != <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr4">_FreeTreeRoot</a> && <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh11">isNodeBlack</a> (x)) +00350 { +00351 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a572">x</a> == <a class="code" href="a04223.html#a572">x</a>->Parent->Left) +00352 { +00353 CFreeNode *<a class="code" href="a04223.html#a575">w</a> = <a class="code" href="a04223.html#a572">x</a>->Parent->Right; +00354 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh14">isNodeRed</a> (w)) +00355 { +00356 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack</a> (w); +00357 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh22">setNodeRed</a> (<a class="code" href="a04223.html#a572">x</a>->Parent); +00358 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord14">rotateLeft</a> (<a class="code" href="a04223.html#a572">x</a>->Parent); +00359 +00360 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (w); +00361 +00362 <a class="code" href="a04223.html#a575">w</a> = <a class="code" href="a04223.html#a572">x</a>->Parent->Right; +00363 } +00364 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh11">isNodeBlack</a> (<a class="code" href="a04223.html#a575">w</a>->Left) && <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh11">isNodeBlack</a> (<a class="code" href="a04223.html#a575">w</a>->Right)) +00365 { +00366 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh22">setNodeRed</a> (w); +00367 <a class="code" href="a04223.html#a572">x</a> = <a class="code" href="a04223.html#a572">x</a>->Parent; +00368 +00369 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (w); +00370 } +00371 <span class="keywordflow">else</span> +00372 { +00373 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh11">isNodeBlack</a> (<a class="code" href="a04223.html#a575">w</a>->Right)) +00374 { +00375 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack</a> (<a class="code" href="a04223.html#a575">w</a>->Left); +00376 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh22">setNodeRed</a> (w); +00377 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord15">rotateRight</a> (w); +00378 <a class="code" href="a04223.html#a575">w</a> = <a class="code" href="a04223.html#a572">x</a>->Parent->Right; +00379 } +00380 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh19">setNodeColor</a> (w, isNodeRed (<a class="code" href="a04223.html#a572">x</a>->Parent)); +00381 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack</a> (<a class="code" href="a04223.html#a572">x</a>->Parent); +00382 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack</a> (<a class="code" href="a04223.html#a575">w</a>->Right); +00383 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord14">rotateLeft</a> (<a class="code" href="a04223.html#a572">x</a>->Parent); +00384 +00385 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (w); +00386 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (<a class="code" href="a04223.html#a575">w</a>->Right); +00387 +00388 <a class="code" href="a04223.html#a572">x</a> = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr4">_FreeTreeRoot</a>; +00389 } +00390 } +00391 <span class="keywordflow">else</span> +00392 { +00393 CFreeNode *<a class="code" href="a04223.html#a575">w</a> = <a class="code" href="a04223.html#a572">x</a>->Parent->Left; +00394 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh14">isNodeRed</a> (w)) +00395 { +00396 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack</a> (w); +00397 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh22">setNodeRed</a> (<a class="code" href="a04223.html#a572">x</a>->Parent); +00398 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord15">rotateRight</a> (<a class="code" href="a04223.html#a572">x</a>->Parent); +00399 +00400 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (w); +00401 +00402 <a class="code" href="a04223.html#a575">w</a> = <a class="code" href="a04223.html#a572">x</a>->Parent->Left; +00403 } +00404 <span class="keywordflow">if</span> ( <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh11">isNodeBlack</a> (<a class="code" href="a04223.html#a575">w</a>->Right) && <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh11">isNodeBlack</a> (<a class="code" href="a04223.html#a575">w</a>->Left) ) +00405 { +00406 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh22">setNodeRed</a> (w); +00407 <a class="code" href="a04223.html#a572">x</a> = <a class="code" href="a04223.html#a572">x</a>->Parent; +00408 +00409 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (w); +00410 } +00411 <span class="keywordflow">else</span> +00412 { +00413 <span class="keywordflow">if</span> ( <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh11">isNodeBlack</a> (<a class="code" href="a04223.html#a575">w</a>->Left) ) +00414 { +00415 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack</a> (<a class="code" href="a04223.html#a575">w</a>->Right); +00416 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh22">setNodeRed</a> (w); +00417 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord14">rotateLeft</a> (w); +00418 <a class="code" href="a04223.html#a575">w</a> = <a class="code" href="a04223.html#a572">x</a>->Parent->Left; +00419 } +00420 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh19">setNodeColor</a> (w, isNodeRed (<a class="code" href="a04223.html#a572">x</a>->Parent) ); +00421 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack</a> (<a class="code" href="a04223.html#a572">x</a>->Parent); +00422 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack</a> (<a class="code" href="a04223.html#a575">w</a>->Left); +00423 +00424 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord15">rotateRight</a> (<a class="code" href="a04223.html#a572">x</a>->Parent); +00425 +00426 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (w); +00427 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (<a class="code" href="a04223.html#a575">w</a>->Left); +00428 +00429 <a class="code" href="a04223.html#a572">x</a> = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr4">_FreeTreeRoot</a>; +00430 } +00431 } +00432 } +00433 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack</a> (x); +00434 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (x); +00435 } +00436 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh1" doxytag="NLMISC::CHeapAllocator::evalMagicNumber" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> NLMISC::CHeapAllocator::evalMagicNumber </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>node</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatord7" doxytag="NLMISC::CHeapAllocator::find" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02613.html">CFreeNode</a>* NLMISC::CHeapAllocator::find </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname1" valign="top" nowrap> <em>size</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora12" doxytag="NLMISC::CHeapAllocator::free" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::free </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">void * </td> + <td class="mdname1" valign="top" nowrap> <em>ptr</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l00989">989</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05776.html#l02214">checkNode()</a>, <a class="el" href="a05778.html#l00248">NLMISC::CHeapAllocator::CNodeBegin::EndMagicNumber</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord4">enterCriticalSectionLB()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord5">enterCriticalSectionSB()</a>, <a class="el" href="a05776.html#l00260">erase()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize()</a>, <a class="el" href="a05776.html#l00137">insert()</a>, <a class="el" href="a05776.html#l02074">internalCheckHeap()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh12">isNodeFree()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord12">leaveCriticalSectionLB()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord13">leaveCriticalSectionSB()</a>, <a class="el" href="a05776.html#l00527">mergeNode()</a>, <a class="el" href="a05779.html#l00060">NL_ALLOC_STOP</a>, <a class="el" href="a05777.html#l00502">NL_SIZE_TO_SMALLBLOCK_INDEX</a>, <a class="el" href="a05779.html#l00042">NL_UPDATE_MAGIC_NUMBER</a>, <a class="el" href="a05778.html#l00253">NLMISC::CHeapAllocator::CNodeBegin::Previous</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh20">setNodeFree()</a>, <a class="el" href="a05646.html#l00645">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05776.html#l02189">debugPopCategoryString()</a>. +<p> +<div class="fragment"><pre>00990 { +00991 <span class="comment">// Delete a null pointer ?</span> +00992 <span class="keywordflow">if</span> (ptr == NULL) +00993 { +00994 <span class="comment">// ********</span> +00995 <span class="comment">// * STOP *</span> +00996 <span class="comment">// ********</span> +00997 <span class="comment">// * Attempt to delete a NULL pointer</span> +00998 <span class="comment">// ********</span> +00999 <span class="preprocessor">#ifdef NLMISC_HEAP_STOP_NULL_FREE</span> +01000 <span class="preprocessor"></span> <a class="code" href="a04356.html#a3">NL_ALLOC_STOP</a>; +01001 <span class="preprocessor">#endif // NLMISC_HEAP_STOP_NULL_FREE</span> +01002 <span class="preprocessor"></span> } +01003 <span class="keywordflow">else</span> +01004 { +01005 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01006 <span class="preprocessor"></span> <span class="comment">// Checks ?</span> +01007 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr1">_AlwaysCheck</a>) +01008 { +01009 <span class="comment">// Check heap integrity</span> +01010 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord10">internalCheckHeap</a> (<span class="keyword">true</span>); +01011 } +01012 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01013 <span class="preprocessor"></span> +01014 <span class="comment">// Get the node pointer</span> +01015 CNodeBegin *node = (CNodeBegin*) ((<a class="code" href="a04558.html#a15">uint</a>)ptr - <span class="keyword">sizeof</span> (CNodeBegin)); +01016 +01017 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01018 <span class="preprocessor"></span> <span class="comment">// Check the node CRC</span> +01019 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord5">enterCriticalSectionSB</a> (); +01020 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord4">enterCriticalSectionLB</a> (); +01021 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord1">checkNode</a> (node, evalMagicNumber (node)); +01022 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord12">leaveCriticalSectionLB</a> (); +01023 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord13">leaveCriticalSectionSB</a> (); +01024 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01025 <span class="preprocessor"></span> +01026 <span class="comment">// Large or small block ?</span> +01027 <span class="preprocessor">#ifdef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01028 <span class="preprocessor"></span> <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a587">size</a> = (((CNodeBegin*) ((<a class="code" href="a04558.html#a15">uint</a>)ptr - <span class="keyword">sizeof</span> (CNodeBegin))))->SizeAndFlags; +01029 <span class="preprocessor">#else // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01030 <span class="preprocessor"></span> <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a587">size</a> = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (((CNodeBegin*) ((<a class="code" href="a04558.html#a15">uint</a>)ptr - <span class="keyword">sizeof</span> (CNodeBegin)))); +01031 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01032 <span class="preprocessor"></span> <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a587">size</a> <= <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw8">LastSmallBlock</a>) +01033 { +01034 <span class="comment">// *******************</span> +01035 <span class="comment">// Small block</span> +01036 <span class="comment">// *******************</span> +01037 +01038 <span class="comment">// Check the node has not been deleted</span> +01039 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh12">isNodeFree</a> (node)) +01040 { +01041 <span class="comment">// ********</span> +01042 <span class="comment">// * STOP *</span> +01043 <span class="comment">// ********</span> +01044 <span class="comment">// * Attempt to delete a pointer already deleted</span> +01045 <span class="comment">// ********</span> +01046 <span class="comment">// * (*node): the already deleted node</span> +01047 <span class="comment">// ********</span> +01048 <a class="code" href="a04356.html#a3">NL_ALLOC_STOP</a>; +01049 } +01050 <span class="keywordflow">else</span> +01051 { +01052 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord5">enterCriticalSectionSB</a> (); +01053 +01054 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01055 <span class="preprocessor"></span> <span class="comment">// Uninitialised memory</span> +01056 memset ((<a class="code" href="a04558.html#a7">uint8</a>*)node + <span class="keyword">sizeof</span>(CNodeBegin), DeletedMemory, size ); +01057 +01058 <span class="comment">// Set end pointers</span> +01059 node->EndMagicNumber = (<a class="code" href="a04558.html#a11">uint32</a>*)((<a class="code" href="a04558.html#a7">uint8</a>*)node + <a class="code" href="a04223.html#a587">size</a> + <span class="keyword">sizeof</span> (CNodeBegin)); +01060 +01061 <span class="comment">// Mark has free</span> +01062 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh20">setNodeFree</a> (node); +01063 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01064 <span class="preprocessor"></span> +01065 <span class="comment">// Add in the free list</span> +01066 CNodeBegin **freeNode = (CNodeBegin **)<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_2">_FreeSmallBlocks</a>+<a class="code" href="a04354.html#a4">NL_SIZE_TO_SMALLBLOCK_INDEX</a> (size); +01067 ((CNodeBegin*) ((<a class="code" href="a04558.html#a15">uint</a>)ptr - <span class="keyword">sizeof</span> (CNodeBegin)))->Previous = *freeNode; +01068 *freeNode = ((CNodeBegin*) ((<a class="code" href="a04558.html#a15">uint</a>)ptr - <span class="keyword">sizeof</span> (CNodeBegin))); +01069 +01070 <span class="comment">// Update smallblock crc</span> +01071 <a class="code" href="a04356.html#a1">NL_UPDATE_MAGIC_NUMBER</a> (node); +01072 +01073 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord13">leaveCriticalSectionSB</a> (); +01074 } +01075 } +01076 <span class="keywordflow">else</span> +01077 { +01078 <span class="preprocessor">#ifdef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01079 <span class="preprocessor"></span> <span class="comment">// Get the real size</span> +01080 <a class="code" href="a04223.html#a587">size</a> = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (((CNodeBegin*) ((uint)ptr - <span class="keyword">sizeof</span> (CNodeBegin)))); +01081 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01082 <span class="preprocessor"></span> +01083 <span class="comment">// Get the node pointer</span> +01084 CNodeBegin *node = (CNodeBegin*) ((<a class="code" href="a04558.html#a15">uint</a>)ptr - <span class="keyword">sizeof</span> (CNodeBegin)); +01085 +01086 <span class="comment">// Check the node has not been deleted</span> +01087 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh12">isNodeFree</a> (node)) +01088 { +01089 <span class="comment">// ********</span> +01090 <span class="comment">// * STOP *</span> +01091 <span class="comment">// ********</span> +01092 <span class="comment">// * Attempt to delete a pointer already deleted</span> +01093 <span class="comment">// ********</span> +01094 <span class="comment">// * (*node): the already deleted node</span> +01095 <span class="comment">// ********</span> +01096 <a class="code" href="a04356.html#a3">NL_ALLOC_STOP</a>; +01097 } +01098 <span class="keywordflow">else</span> +01099 { +01100 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord4">enterCriticalSectionLB</a> (); +01101 +01102 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01103 <span class="preprocessor"></span> <span class="comment">// Uninitialised memory</span> +01104 memset ((<a class="code" href="a04558.html#a7">uint8</a>*)node + <span class="keyword">sizeof</span>(CNodeBegin), DeletedMemory, size ); +01105 +01106 <span class="comment">// Set end pointers</span> +01107 node->EndMagicNumber = (<a class="code" href="a04558.html#a11">uint32</a>*)((<a class="code" href="a04558.html#a7">uint8</a>*)node + <a class="code" href="a04223.html#a587">size</a> + <span class="keyword">sizeof</span> (CNodeBegin)); +01108 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01109 <span class="preprocessor"></span> +01110 <span class="comment">// Mark has free</span> +01111 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh20">setNodeFree</a> (node); +01112 +01113 <span class="comment">// *******************</span> +01114 <span class="comment">// Large block</span> +01115 <span class="comment">// *******************</span> +01116 +01117 <span class="comment">// A free node</span> +01118 <span class="comment">//CHeapAllocator::CFreeNode *freeNode = NULL;</span> +01119 +01120 <span class="comment">// Previous node</span> +01121 CNodeBegin *previous = node->Previous; +01122 <span class="keywordflow">if</span> (previous) +01123 { +01124 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01125 <span class="preprocessor"></span> <span class="comment">// Check the previous node</span> +01126 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord1">checkNode</a> (previous, evalMagicNumber (previous)); +01127 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01128 <span class="preprocessor"></span> +01129 <span class="comment">// Is it free ?</span> +01130 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh12">isNodeFree</a> (previous)) +01131 { +01132 <span class="comment">// Merge the two nodes</span> +01133 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh17">mergeNode</a> (node); +01134 +01135 <span class="comment">// Get its free node</span> +01136 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord6">erase</a> (getFreeNode (previous)); +01137 +01138 <span class="comment">// Curent node</span> +01139 node = previous; +01140 } +01141 } +01142 +01143 <span class="comment">// Mark has free</span> +01144 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh20">setNodeFree</a> (node); +01145 +01146 <span class="comment">// Next node</span> +01147 CNodeBegin *next = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode</a> (node); +01148 <span class="keywordflow">if</span> (next) +01149 { +01150 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01151 <span class="preprocessor"></span> <span class="comment">// Check the next node</span> +01152 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord1">checkNode</a> (next, evalMagicNumber (next)); +01153 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01154 <span class="preprocessor"></span> +01155 <span class="comment">// Is it free ?</span> +01156 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh12">isNodeFree</a> (next)) +01157 { +01158 <span class="comment">// Free the new one</span> +01159 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord6">erase</a> (getFreeNode (next)); +01160 +01161 <span class="comment">// Merge the two nodes</span> +01162 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh17">mergeNode</a> (next); +01163 } +01164 } +01165 +01166 <span class="comment">// Insert it into the tree</span> +01167 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord9">insert</a> (getFreeNode (node)); +01168 +01169 <a class="code" href="a04356.html#a1">NL_UPDATE_MAGIC_NUMBER</a> (node); +01170 +01171 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord12">leaveCriticalSectionLB</a> (); +01172 } +01173 } +01174 } +01175 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora13" doxytag="NLMISC::CHeapAllocator::freeAll" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::freeAll </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l01845">1845</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection()</a>, <a class="el" href="a05778.html#l00372">NLMISC::CHeapAllocator::CNullNode::FreeNode</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode()</a>, <a class="el" href="a05776.html#l00576">initEmptyBlock()</a>, <a class="el" href="a05776.html#l00137">insert()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection()</a>, <a class="el" href="a05778.html#l00307">NLMISC::CHeapAllocator::CMainBlock::Next</a>, and <a class="el" href="a05779.html#l00042">NL_UPDATE_MAGIC_NUMBER</a>. +<p> +<div class="fragment"><pre>01846 { +01847 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection</a> (); +01848 +01849 <span class="comment">// Sum free memory</span> +01850 <span class="comment">//uint memory = 0;</span> +01851 +01852 <span class="comment">// Clear the free tree</span> +01853 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr4">_FreeTreeRoot</a> = &<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr9">_NullNode</a>.<a class="code" href="a02623.html#NLMISC_1_1CHeapAllocator_1_1CNullNodeo0">FreeNode</a>; +01854 +01855 <span class="comment">// For each main block</span> +01856 CMainBlock *currentBlock = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr5">_MainBlockList</a>; +01857 <span class="keywordflow">while</span> (currentBlock) +01858 { +01859 <span class="comment">// Reinit this block</span> +01860 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord8">initEmptyBlock</a> (*currentBlock); +01861 +01862 <span class="comment">// Get first block</span> +01863 CNodeBegin *node = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode</a> (currentBlock); +01864 +01865 <span class="comment">// Insert the free node</span> +01866 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord9">insert</a> (getFreeNode (node)); +01867 +01868 <a class="code" href="a04356.html#a1">NL_UPDATE_MAGIC_NUMBER</a> (node); +01869 +01870 <span class="comment">// Next block</span> +01871 currentBlock = currentBlock->Next; +01872 } +01873 +01874 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection</a> (); +01875 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora14" doxytag="NLMISC::CHeapAllocator::freeBlock" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::freeBlock </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a7">uint8</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>block</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [virtual]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l02067">2067</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05776.html#l01879">releaseMemory()</a>. +<p> +<div class="fragment"><pre>02068 { +02069 ::free (block); +02070 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora15" doxytag="NLMISC::CHeapAllocator::getAllocatedMemory" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NLMISC::CHeapAllocator::getAllocatedMemory </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l01181">1181</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05776.html#l02214">checkNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_6">getSmallBlock()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh16">isNodeUsed()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection()</a>, <a class="el" href="a05778.html#l00307">NLMISC::CHeapAllocator::CMainBlock::Next</a>, <a class="el" href="a05778.html#l00425">NLMISC::CHeapAllocator::CSmallBlockPool::Next</a>, <a class="el" href="a05775.html#l00919">NL_HEAP_SB_CATEGORY</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>01182 { +01183 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection</a> (); +01184 +01185 <span class="comment">// Sum allocated memory</span> +01186 <a class="code" href="a04558.html#a15">uint</a> memory = 0; +01187 +01188 <span class="comment">// For each small block</span> +01189 CSmallBlockPool *currentSB = (CSmallBlockPool *)<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_4">_SmallBlockPool</a>; +01190 <span class="keywordflow">while</span> (currentSB) +01191 { +01192 <span class="comment">// For each node in this small block pool</span> +01193 <a class="code" href="a04558.html#a15">uint</a> block; +01194 <span class="keywordflow">for</span> (block=0; block<<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw14">SmallBlockPoolSize</a>; block++) +01195 { +01196 <span class="comment">// Get the node</span> +01197 <span class="keyword">const</span> CNodeBegin *current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_6">getSmallBlock</a> (currentSB, block); +01198 +01199 <span class="comment">// Node allocated ?</span> +01200 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh16">isNodeUsed</a> (current)) +01201 memory += <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (current) + <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw10">ReleaseHeaderSize</a>; +01202 } +01203 +01204 <span class="comment">// Next block</span> +01205 currentSB = currentSB->Next; +01206 } +01207 +01208 <span class="comment">// For each main block</span> +01209 CMainBlock *currentBlock = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr5">_MainBlockList</a>; +01210 <span class="keywordflow">while</span> (currentBlock) +01211 { +01212 <span class="comment">// Get the first node</span> +01213 <span class="keyword">const</span> CNodeBegin *current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode</a> (currentBlock); +01214 <span class="keywordflow">while</span> (current) +01215 { +01216 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01217 <span class="preprocessor"></span> <span class="comment">// Check node</span> +01218 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord1">checkNode</a> (current, evalMagicNumber (current)); +01219 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01220 <span class="preprocessor"></span> +01221 <span class="comment">// Node allocated ? Don't sum small blocks..</span> +01222 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh16">isNodeUsed</a> (current)) +01223 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01224 <span class="preprocessor"></span> <span class="keywordflow">if</span> (strcmp (current->Category, NL_HEAP_SB_CATEGORY) != 0) +01225 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01226 <span class="preprocessor"></span> memory += <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (current) + <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw10">ReleaseHeaderSize</a>; +01227 +01228 <span class="comment">// Next node</span> +01229 current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode</a> (current); +01230 } +01231 +01232 <span class="comment">// Next block</span> +01233 currentBlock = currentBlock->Next; +01234 } +01235 +01236 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection</a> (); +01237 +01238 <span class="comment">// Return memory used</span> +01239 <span class="keywordflow">return</span> memory; +01240 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatore0" doxytag="NLMISC::CHeapAllocator::getAllocatedSystemMemory" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NLMISC::CHeapAllocator::getAllocatedSystemMemory </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l02269">2269</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05646.html#l00649">buffer</a>, <a class="el" href="a05646.html#l00235">len</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05776.html#l02259">NLMISC::skipToken()</a>, <a class="el" href="a05776.html#l02253">NLMISC::skipWS()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a05776.html#l01393">debugStatisticsReport()</a>. +<p> +<div class="fragment"><pre>02270 { +02271 <a class="code" href="a04558.html#a15">uint</a> systemMemory = 0; +02272 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span> +02273 <span class="preprocessor"></span> <span class="comment">// Get system memory informations</span> +02274 HANDLE hHeap[100]; +02275 DWORD heapCount = GetProcessHeaps (100, hHeap); +02276 +02277 <a class="code" href="a04558.html#a15">uint</a> heap; +02278 <span class="keywordflow">for</span> (heap = 0; heap < heapCount; heap++) +02279 { +02280 PROCESS_HEAP_ENTRY entry; +02281 entry.lpData = NULL; +02282 <span class="keywordflow">while</span> (HeapWalk (hHeap[heap], &entry)) +02283 { +02284 <span class="keywordflow">if</span> (entry.wFlags & PROCESS_HEAP_ENTRY_BUSY) +02285 { +02286 systemMemory += entry.cbData + entry.cbOverhead; +02287 } +02288 } +02289 } +02290 +02291 <span class="preprocessor">#elif defined NL_OS_UNIX</span> +02292 <span class="preprocessor"></span> +02293 <span class="keywordtype">int</span> fd = open(<span class="stringliteral">"/proc/self/stat"</span>, O_RDONLY); +02294 <span class="keywordflow">if</span> (fd == -1) +02295 { +02296 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HA: Can't get OS from /proc/self/stat: %s"</span>, strerror (errno)); +02297 } +02298 <span class="keywordflow">else</span> +02299 { +02300 <span class="keywordtype">char</span> <a class="code" href="a04223.html#a589">buffer</a>[4096], *p; +02301 <span class="keywordtype">int</span> <a class="code" href="a04223.html#a571">len</a> = read(fd, buffer, <span class="keyword">sizeof</span>(buffer)-1); +02302 close(fd); +02303 +02304 <a class="code" href="a04223.html#a589">buffer</a>[<a class="code" href="a04223.html#a571">len</a>] = <span class="charliteral">'\0'</span>; +02305 +02306 p = <a class="code" href="a04223.html#a589">buffer</a>; +02307 p = strchr(p, <span class="charliteral">')'</span>)+1; <span class="comment">/* skip pid */</span> +02308 p = <a class="code" href="a05378.html#a329">skipWS</a>(p); +02309 p++; +02310 +02311 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* skip ppid */</span> +02312 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* skip pgrp */</span> +02313 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* skip session */</span> +02314 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* skip tty */</span> +02315 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* skip tty pgrp */</span> +02316 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* skip flags */</span> +02317 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* skip min flt */</span> +02318 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* skip cmin flt */</span> +02319 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* skip maj flt */</span> +02320 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* skip cmaj flt */</span> +02321 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* utime */</span> +02322 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* stime */</span> +02323 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* skip cutime */</span> +02324 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* skip cstime */</span> +02325 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* priority */</span> +02326 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* nice */</span> +02327 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* skip timeout */</span> +02328 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* skip it_real_val */</span> +02329 p = <a class="code" href="a05378.html#a330">skipToken</a>(p); <span class="comment">/* skip start_time */</span> +02330 +02331 systemMemory = strtoul(p, &p, 10); <span class="comment">/* vsize in bytes */</span> +02332 } +02333 +02334 <span class="preprocessor">#endif // NL_OS_WINDOWS</span> +02335 <span class="preprocessor"></span> <span class="keywordflow">return</span> systemMemory; +02336 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora16" doxytag="NLMISC::CHeapAllocator::getAllocatedSystemMemoryByAllocator" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NLMISC::CHeapAllocator::getAllocatedSystemMemoryByAllocator </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l02340">2340</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a05776.html#l01393">debugStatisticsReport()</a>. +<p> +<div class="fragment"><pre>02341 { +02342 <a class="code" href="a04558.html#a15">uint</a> nelSystemMemory = 0; +02343 +02344 <span class="comment">// Build a set of allocated system memory pointers</span> +02345 std::set<void*> ptrInUse; +02346 +02347 <span class="comment">// For each main block</span> +02348 CMainBlock *currentBlock = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr5">_MainBlockList</a>; +02349 <span class="keywordflow">while</span> (currentBlock) +02350 { +02351 <span class="comment">// Save pointers</span> +02352 ptrInUse.insert ((<span class="keywordtype">void</span>*)currentBlock); +02353 ptrInUse.insert ((<span class="keywordtype">void</span>*)(currentBlock->Ptr)); +02354 +02355 <span class="comment">// Next block</span> +02356 currentBlock = currentBlock->Next; +02357 } +02358 +02359 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span> +02360 <span class="preprocessor"></span> <span class="comment">// Get system memory informations</span> +02361 HANDLE hHeap[100]; +02362 DWORD heapCount = GetProcessHeaps (100, hHeap); +02363 +02364 <a class="code" href="a04558.html#a15">uint</a> heap; +02365 <span class="keywordflow">for</span> (heap = 0; heap < heapCount; heap++) +02366 { +02367 PROCESS_HEAP_ENTRY entry; +02368 entry.lpData = NULL; +02369 <span class="keywordflow">while</span> (HeapWalk (hHeap[heap], &entry)) +02370 { +02371 <span class="keywordflow">if</span> (entry.wFlags & PROCESS_HEAP_ENTRY_BUSY) +02372 { +02373 <span class="comment">// This pointer is already used ?</span> +02374 <span class="keywordflow">if</span> ( (ptrInUse.find ((<span class="keywordtype">void</span>*)((<span class="keywordtype">char</span>*)entry.lpData)) != ptrInUse.end ()) || +02375 (ptrInUse.find ((<span class="keywordtype">void</span>*)((<span class="keywordtype">char</span>*)entry.lpData+32)) != ptrInUse.end ()) ) +02376 nelSystemMemory += entry.cbData + entry.cbOverhead; +02377 } +02378 } +02379 } +02380 <span class="preprocessor">#endif // NL_OS_WINDOWS</span> +02381 <span class="preprocessor"></span> <span class="keywordflow">return</span> nelSystemMemory; +02382 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora17" doxytag="NLMISC::CHeapAllocator::getBlockAllocationMode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw15">TBlockAllocationMode</a> NLMISC::CHeapAllocator::getBlockAllocationMode </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatore1" doxytag="NLMISC::CHeapAllocator::getBlockSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NLMISC::CHeapAllocator::getBlockSize </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">void * </td> + <td class="mdname1" valign="top" nowrap> <em>block</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l00631">631</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>00632 { +00633 <span class="comment">// Get the node pointer</span> +00634 <span class="comment">//CNodeBegin *node = (CNodeBegin*) ((uint)block - sizeof (CNodeBegin));</span> +00635 +00636 <span class="keywordflow">return</span> <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (((CNodeBegin*) ((<a class="code" href="a04558.html#a15">uint</a>)block - <span class="keyword">sizeof</span> (CNodeBegin)))); +00637 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh2" doxytag="NLMISC::CHeapAllocator::getFirstNode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02619.html">CNodeBegin</a>* NLMISC::CHeapAllocator::getFirstNode </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02615.html">CMainBlock</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>mainBlock</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh3" doxytag="NLMISC::CHeapAllocator::getFirstNode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const <a class="el" href="a02619.html">CNodeBegin</a>* NLMISC::CHeapAllocator::getFirstNode </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02615.html">CMainBlock</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>mainBlock</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l01245">debugGetAllocatedMemoryByCategory()</a>, <a class="el" href="a05776.html#l01310">debugGetLBDebugInfoSize()</a>, <a class="el" href="a05776.html#l01916">debugReportMemoryLeak()</a>, <a class="el" href="a05776.html#l01393">debugStatisticsReport()</a>, <a class="el" href="a05776.html#l01845">freeAll()</a>, <a class="el" href="a05776.html#l01181">getAllocatedMemory()</a>, <a class="el" href="a05776.html#l01804">getFragmentationRatio()</a>, <a class="el" href="a05776.html#l01685">getFreeMemory()</a>, <a class="el" href="a05776.html#l00576">initEmptyBlock()</a>, and <a class="el" href="a05776.html#l02074">internalCheckHeap()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora18" doxytag="NLMISC::CHeapAllocator::getFragmentationRatio" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> float NLMISC::CHeapAllocator::getFragmentationRatio </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l01804">1804</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh16">isNodeUsed()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection()</a>, and <a class="el" href="a05778.html#l00307">NLMISC::CHeapAllocator::CMainBlock::Next</a>. +<p> +<div class="fragment"><pre>01805 { +01806 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection</a> (); +01807 +01808 <span class="comment">// Sum free and used node</span> +01809 <span class="keywordtype">float</span> <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatora12">free</a> = 0; +01810 <span class="keywordtype">float</span> used = 0; +01811 +01812 <span class="comment">// For each main block</span> +01813 CMainBlock *currentBlock = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr5">_MainBlockList</a>; +01814 <span class="keywordflow">while</span> (currentBlock) +01815 { +01816 <span class="comment">// Get the first node</span> +01817 <span class="keyword">const</span> CNodeBegin *current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode</a> (currentBlock); +01818 <span class="keywordflow">while</span> (current) +01819 { +01820 <span class="comment">// Node allocated ?</span> +01821 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh16">isNodeUsed</a> (current)) +01822 used++; +01823 <span class="keywordflow">else</span> +01824 free++; +01825 +01826 <span class="comment">// Next node</span> +01827 current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode</a> (current); +01828 } +01829 +01830 <span class="comment">// Next block</span> +01831 currentBlock = currentBlock->Next; +01832 } +01833 +01834 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection</a> (); +01835 +01836 <span class="comment">// Return the memory</span> +01837 <span class="keywordflow">if</span> (used != 0) +01838 <span class="keywordflow">return</span> free / used; +01839 <span class="keywordflow">else</span> +01840 <span class="keywordflow">return</span> 0; +01841 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora19" doxytag="NLMISC::CHeapAllocator::getFreeMemory" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NLMISC::CHeapAllocator::getFreeMemory </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l01685">1685</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05776.html#l02214">checkNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_6">getSmallBlock()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh12">isNodeFree()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection()</a>, <a class="el" href="a05778.html#l00307">NLMISC::CHeapAllocator::CMainBlock::Next</a>, <a class="el" href="a05778.html#l00425">NLMISC::CHeapAllocator::CSmallBlockPool::Next</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>01686 { +01687 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection</a> (); +01688 +01689 <span class="comment">// Sum free memory</span> +01690 <a class="code" href="a04558.html#a15">uint</a> memory = 0; +01691 +01692 <span class="comment">// For each small block</span> +01693 CSmallBlockPool *currentSB = (CSmallBlockPool *)<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_4">_SmallBlockPool</a>; +01694 <span class="keywordflow">while</span> (currentSB) +01695 { +01696 <span class="comment">// For each node in this small block pool</span> +01697 <a class="code" href="a04558.html#a15">uint</a> block; +01698 <span class="keywordflow">for</span> (block=0; block<<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw14">SmallBlockPoolSize</a>; block++) +01699 { +01700 <span class="comment">// Get the node</span> +01701 <span class="keyword">const</span> CNodeBegin *current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_6">getSmallBlock</a> (currentSB, block); +01702 +01703 <span class="comment">// Node allocated ?</span> +01704 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh12">isNodeFree</a> (current)) +01705 memory += <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (current) + <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw10">ReleaseHeaderSize</a>; +01706 +01707 <span class="comment">// Next node</span> +01708 current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode</a> (current); +01709 } +01710 +01711 <span class="comment">// Next block</span> +01712 currentSB = currentSB->Next; +01713 } +01714 +01715 <span class="comment">// For each main block</span> +01716 CMainBlock *currentBlock = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr5">_MainBlockList</a>; +01717 <span class="keywordflow">while</span> (currentBlock) +01718 { +01719 <span class="comment">// Get the first node</span> +01720 <span class="keyword">const</span> CNodeBegin *current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode</a> (currentBlock); +01721 <span class="keywordflow">while</span> (current) +01722 { +01723 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01724 <span class="preprocessor"></span> <span class="comment">// Check node</span> +01725 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord1">checkNode</a> (current, evalMagicNumber (current)); +01726 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +01727 <span class="preprocessor"></span> +01728 <span class="comment">// Node allocated ?</span> +01729 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh12">isNodeFree</a> (current)) +01730 memory += <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (current) + <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorw0NLMISC_1_1CHeapAllocatorw10">ReleaseHeaderSize</a>; +01731 +01732 <span class="comment">// Next node</span> +01733 current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode</a> (current); +01734 } +01735 +01736 <span class="comment">// Next block</span> +01737 currentBlock = currentBlock->Next; +01738 } +01739 +01740 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection</a> (); +01741 +01742 <span class="comment">// Return memory used</span> +01743 <span class="keywordflow">return</span> memory; +01744 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh4" doxytag="NLMISC::CHeapAllocator::getFreeNode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02613.html">CFreeNode</a>* NLMISC::CHeapAllocator::getFreeNode </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>current</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh5" doxytag="NLMISC::CHeapAllocator::getFreeNode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const <a class="el" href="a02613.html">CFreeNode</a>* NLMISC::CHeapAllocator::getFreeNode </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>current</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora20" doxytag="NLMISC::CHeapAllocator::getMainBlockCount" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NLMISC::CHeapAllocator::getMainBlockCount </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora21" doxytag="NLMISC::CHeapAllocator::getMainBlockSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NLMISC::CHeapAllocator::getMainBlockSize </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora22" doxytag="NLMISC::CHeapAllocator::getName" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const char* NLMISC::CHeapAllocator::getName </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh6" doxytag="NLMISC::CHeapAllocator::getNextNode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02619.html">CNodeBegin</a>* NLMISC::CHeapAllocator::getNextNode </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>current</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh7" doxytag="NLMISC::CHeapAllocator::getNextNode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const <a class="el" href="a02619.html">CNodeBegin</a>* NLMISC::CHeapAllocator::getNextNode </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>current</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l01245">debugGetAllocatedMemoryByCategory()</a>, <a class="el" href="a05776.html#l01310">debugGetLBDebugInfoSize()</a>, <a class="el" href="a05776.html#l01916">debugReportMemoryLeak()</a>, <a class="el" href="a05776.html#l01393">debugStatisticsReport()</a>, <a class="el" href="a05776.html#l00989">free()</a>, <a class="el" href="a05776.html#l01181">getAllocatedMemory()</a>, <a class="el" href="a05776.html#l01804">getFragmentationRatio()</a>, <a class="el" href="a05776.html#l01685">getFreeMemory()</a>, <a class="el" href="a05776.html#l02074">internalCheckHeap()</a>, <a class="el" href="a05776.html#l00527">mergeNode()</a>, and <a class="el" href="a05776.html#l00442">splitNode()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorz1952_5" doxytag="NLMISC::CHeapAllocator::getNextSmallBlock" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02619.html">CNodeBegin</a>* NLMISC::CHeapAllocator::getNextSmallBlock </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>previous</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh8" doxytag="NLMISC::CHeapAllocator::getNode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02619.html">CNodeBegin</a>* NLMISC::CHeapAllocator::getNode </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02613.html">CFreeNode</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>current</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh9" doxytag="NLMISC::CHeapAllocator::getNode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const <a class="el" href="a02619.html">CNodeBegin</a>* NLMISC::CHeapAllocator::getNode </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02613.html">CFreeNode</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>current</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh10" doxytag="NLMISC::CHeapAllocator::getNodeSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NLMISC::CHeapAllocator::getNodeSize </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>current</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l01245">debugGetAllocatedMemoryByCategory()</a>, <a class="el" href="a05776.html#l01916">debugReportMemoryLeak()</a>, <a class="el" href="a05776.html#l01393">debugStatisticsReport()</a>, <a class="el" href="a05776.html#l00989">free()</a>, <a class="el" href="a05776.html#l01181">getAllocatedMemory()</a>, <a class="el" href="a05776.html#l00631">getBlockSize()</a>, <a class="el" href="a05776.html#l01685">getFreeMemory()</a>, <a class="el" href="a05776.html#l00576">initEmptyBlock()</a>, <a class="el" href="a05776.html#l00137">insert()</a>, <a class="el" href="a05776.html#l00527">mergeNode()</a>, and <a class="el" href="a05776.html#l00442">splitNode()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora23" doxytag="NLMISC::CHeapAllocator::getOutOfMemoryMode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw18">TOutOfMemoryMode</a> NLMISC::CHeapAllocator::getOutOfMemoryMode </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorz1952_6" doxytag="NLMISC::CHeapAllocator::getSmallBlock" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02619.html">CNodeBegin</a>* NLMISC::CHeapAllocator::getSmallBlock </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02625.html">CSmallBlockPool</a> * </td> + <td class="mdname" nowrap> <em>smallBlock</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>blockIndex</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l01245">debugGetAllocatedMemoryByCategory()</a>, <a class="el" href="a05776.html#l01916">debugReportMemoryLeak()</a>, <a class="el" href="a05776.html#l01393">debugStatisticsReport()</a>, <a class="el" href="a05776.html#l01181">getAllocatedMemory()</a>, <a class="el" href="a05776.html#l01685">getFreeMemory()</a>, and <a class="el" href="a05776.html#l02074">internalCheckHeap()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora24" doxytag="NLMISC::CHeapAllocator::getSmallBlockMemory" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NLMISC::CHeapAllocator::getSmallBlockMemory </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l01777">1777</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection()</a>, <a class="el" href="a05778.html#l00425">NLMISC::CHeapAllocator::CSmallBlockPool::Next</a>, <a class="el" href="a05777.html#l00324">NL_HEAP_NODE_END_SIZE</a>, <a class="el" href="a05778.html#l00424">NLMISC::CHeapAllocator::CSmallBlockPool::Size</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>01778 { +01779 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection</a> (); +01780 +01781 <span class="comment">// Sum total memory</span> +01782 <a class="code" href="a04558.html#a15">uint</a> memory = 0; +01783 +01784 <span class="comment">// For each small block</span> +01785 CSmallBlockPool *currentSB = (CSmallBlockPool *)<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_4">_SmallBlockPool</a>; +01786 <span class="keywordflow">while</span> (currentSB) +01787 { +01788 <span class="comment">// Get block size</span> +01789 memory += <span class="keyword">sizeof</span>(CSmallBlockPool) + <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw14">SmallBlockPoolSize</a> * (<span class="keyword">sizeof</span>(CNodeBegin) + currentSB->Size + +01790 <a class="code" href="a04354.html#a2">NL_HEAP_NODE_END_SIZE</a>); +01791 +01792 <span class="comment">// Next block</span> +01793 currentSB = currentSB->Next; +01794 } +01795 +01796 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection</a> (); +01797 +01798 <span class="comment">// Return the memory</span> +01799 <span class="keywordflow">return</span> memory; +01800 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora25" doxytag="NLMISC::CHeapAllocator::getTotalMemoryUsed" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NLMISC::CHeapAllocator::getTotalMemoryUsed </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l01748">1748</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection()</a>, <a class="el" href="a05778.html#l00307">NLMISC::CHeapAllocator::CMainBlock::Next</a>, <a class="el" href="a05778.html#l00305">NLMISC::CHeapAllocator::CMainBlock::Size</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>01749 { +01750 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection</a> (); +01751 +01752 <span class="comment">// Sum total memory</span> +01753 <a class="code" href="a04558.html#a15">uint</a> memory = 0; +01754 +01755 <span class="comment">// For each main block</span> +01756 CMainBlock *currentBlock = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr5">_MainBlockList</a>; +01757 <span class="keywordflow">while</span> (currentBlock) +01758 { +01759 <span class="comment">// Get block size</span> +01760 memory += currentBlock-><a class="code" href="a02615.html#NLMISC_1_1CHeapAllocator_1_1CMainBlocko2">Size</a>; +01761 +01762 <span class="comment">// Sum the arrays</span> +01763 memory += <span class="keyword">sizeof</span> (CMainBlock); +01764 +01765 <span class="comment">// Next block</span> +01766 currentBlock = currentBlock->Next; +01767 } +01768 +01769 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection</a> (); +01770 +01771 <span class="comment">// Return the memory</span> +01772 <span class="keywordflow">return</span> memory; +01773 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatord8" doxytag="NLMISC::CHeapAllocator::initEmptyBlock" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::initEmptyBlock </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02615.html">CMainBlock</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>mainBlock</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l00576">576</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05778.html#l00243">NLMISC::CHeapAllocator::CNodeBegin::BeginMarkers</a>, <a class="el" href="a05778.html#l00248">NLMISC::CHeapAllocator::CNodeBegin::EndMagicNumber</a>, <a class="el" href="a05778.html#l00265">NLMISC::CHeapAllocator::CNodeEnd::EndMarkers</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize()</a>, <a class="el" href="a05779.html#l00032">internalAssert</a>, <a class="el" href="a05777.html#l00324">NL_HEAP_NODE_END_SIZE</a>, <a class="el" href="a05779.html#l00042">NL_UPDATE_MAGIC_NUMBER</a>, <a class="el" href="a05778.html#l00253">NLMISC::CHeapAllocator::CNodeBegin::Previous</a>, <a class="el" href="a05778.html#l00306">NLMISC::CHeapAllocator::CMainBlock::Ptr</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh20">setNodeFree()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh21">setNodeLast()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh23">setNodeSize()</a>, <a class="el" href="a05778.html#l00305">NLMISC::CHeapAllocator::CMainBlock::Size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05776.html#l01845">freeAll()</a>. +<p> +<div class="fragment"><pre>00577 { +00578 <span class="comment">// Get the node pointer</span> +00579 CNodeBegin *node = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode</a> (&mainBlock); +00580 +00581 <span class="comment">// Allocated size remaining after alignment</span> +00582 <a class="code" href="a04356.html#a0">internalAssert</a> ((<a class="code" href="a04558.html#a11">uint32</a>)node - (<a class="code" href="a04558.html#a11">uint32</a>)mainBlock.Ptr >= 0); +00583 <a class="code" href="a04558.html#a15">uint</a> allocSize = mainBlock.Size - ((<a class="code" href="a04558.html#a11">uint32</a>)node - (<a class="code" href="a04558.html#a11">uint32</a>)mainBlock.Ptr); +00584 +00585 <span class="comment">// *** Fill the new node header</span> +00586 +00587 <span class="comment">// User data size</span> +00588 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh23">setNodeSize</a> (node, allocSize-<span class="keyword">sizeof</span> (CNodeBegin)-NL_HEAP_NODE_END_SIZE); +00589 +00590 <span class="comment">// Node is free</span> +00591 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh20">setNodeFree</a> (node); +00592 +00593 <span class="comment">// Node is last</span> +00594 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh21">setNodeLast</a> (node, <span class="keyword">true</span>); +00595 +00596 <span class="comment">// No previous node</span> +00597 node->Previous = NULL; +00598 +00599 <span class="comment">// Debug info</span> +00600 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00601 <span class="preprocessor"></span> <span class="comment">// End magic number</span> +00602 node->EndMagicNumber = (<a class="code" href="a04558.html#a11">uint32</a>*)((<a class="code" href="a04558.html#a7">uint8</a>*)node + <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (node) + <span class="keyword">sizeof</span> (CNodeBegin)); +00603 +00604 <span class="comment">// Begin markers</span> +00605 memset (node->BeginMarkers, BeginNodeMarkers, CNodeBegin::MarkerSize-1); +00606 node->BeginMarkers[CNodeBegin::MarkerSize-1] = 0; +00607 +00608 <span class="comment">// End markers</span> +00609 CNodeEnd *endNode = (CNodeEnd*)node->EndMagicNumber; +00610 memset (endNode->EndMarkers, EndNodeMarkers, CNodeEnd::MarkerSize-1); +00611 endNode->EndMarkers[CNodeEnd::MarkerSize-1] = 0; +00612 +00613 <span class="comment">// Unallocated memory</span> +00614 memset ((<a class="code" href="a04558.html#a7">uint8</a>*)node + <span class="keyword">sizeof</span>(CNodeBegin), UnallocatedMemory, getNodeSize (node) ); +00615 +00616 <span class="comment">// No source file</span> +00617 memset (node->Category, 0, CategoryStringLength); +00618 node->File = NULL; +00619 node->Line = 0xffff; +00620 node->AllocateNumber = 0xffffffff; +00621 +00622 <span class="comment">// Heap pointer</span> +00623 node->Heap = <span class="keyword">this</span>; +00624 +00625 <a class="code" href="a04356.html#a1">NL_UPDATE_MAGIC_NUMBER</a> (node); +00626 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00627 <span class="preprocessor"></span>} +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatord9" doxytag="NLMISC::CHeapAllocator::insert" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::insert </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02613.html">CFreeNode</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>x</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l00137">137</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05778.html#l00372">NLMISC::CHeapAllocator::CNullNode::FreeNode</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh14">isNodeRed()</a>, <a class="el" href="a05778.html#l00324">NLMISC::CHeapAllocator::CFreeNode::Left</a>, <a class="el" href="a05779.html#l00047">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a>, <a class="el" href="a05778.html#l00325">NLMISC::CHeapAllocator::CFreeNode::Right</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord14">rotateLeft()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord15">rotateRight()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh22">setNodeRed()</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>. +<p> +Referenced by <a class="el" href="a05776.html#l00989">free()</a>, and <a class="el" href="a05776.html#l01845">freeAll()</a>. +<p> +<div class="fragment"><pre>00138 { +00139 CHeapAllocator::CFreeNode *current, *parent; +00140 +00141 <span class="comment">// Find future parent</span> +00142 current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr4">_FreeTreeRoot</a>; +00143 parent = NULL; +00144 <span class="keywordflow">while</span> (current != &<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr9">_NullNode</a>.<a class="code" href="a02623.html#NLMISC_1_1CHeapAllocator_1_1CNullNodeo0">FreeNode</a>) +00145 { +00146 parent = current; +00147 current = (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (getNode (x)) <= <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (getNode (current)) ) ? current-><a class="code" href="a02613.html#NLMISC_1_1CHeapAllocator_1_1CFreeNodeo1">Left</a> : current-><a class="code" href="a02613.html#NLMISC_1_1CHeapAllocator_1_1CFreeNodeo3">Right</a>; +00148 } +00149 +00150 <span class="comment">// Setup new node</span> +00151 <a class="code" href="a04223.html#a572">x</a>->Parent = parent; +00152 <a class="code" href="a04223.html#a572">x</a>->Left = &<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr9">_NullNode</a>.<a class="code" href="a02623.html#NLMISC_1_1CHeapAllocator_1_1CNullNodeo0">FreeNode</a>; +00153 <a class="code" href="a04223.html#a572">x</a>->Right = &<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr9">_NullNode</a>.<a class="code" href="a02623.html#NLMISC_1_1CHeapAllocator_1_1CNullNodeo0">FreeNode</a>; +00154 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh22">setNodeRed</a> (x); +00155 +00156 <span class="comment">// Insert node in tree</span> +00157 <span class="keywordflow">if</span> (parent) +00158 { +00159 <span class="keywordflow">if</span>(<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (getNode (x)) <= <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (getNode (parent))) +00160 parent->Left = <a class="code" href="a04223.html#a572">x</a>; +00161 <span class="keywordflow">else</span> +00162 parent->Right = <a class="code" href="a04223.html#a572">x</a>; +00163 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (parent); +00164 } +00165 <span class="keywordflow">else</span> +00166 { +00167 _FreeTreeRoot = <a class="code" href="a04223.html#a572">x</a>; +00168 } +00169 +00170 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (x); +00171 +00172 <span class="comment">// Maintain Red-Black tree balance</span> +00173 <span class="comment">// After inserting node x</span> +00174 <span class="comment">// Check Red-Black properties</span> +00175 +00176 <span class="keywordflow">while</span> (<a class="code" href="a04223.html#a572">x</a> != _FreeTreeRoot && <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh14">isNodeRed</a> (<a class="code" href="a04223.html#a572">x</a>->Parent)) +00177 { +00178 <span class="comment">// We have a violation</span> +00179 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a572">x</a>->Parent == <a class="code" href="a04223.html#a572">x</a>->Parent->Parent->Left) +00180 { +00181 CHeapAllocator::CFreeNode *<a class="code" href="a04223.html#a573">y</a> = <a class="code" href="a04223.html#a572">x</a>->Parent->Parent->Right; +00182 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh14">isNodeRed</a> (y)) +00183 { +00184 <span class="comment">// Uncle is RED</span> +00185 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack</a> (<a class="code" href="a04223.html#a572">x</a>->Parent); +00186 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack</a> (y); +00187 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh22">setNodeRed</a> (<a class="code" href="a04223.html#a572">x</a>->Parent->Parent); +00188 +00189 <span class="comment">// Crc node</span> +00190 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (y); +00191 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (<a class="code" href="a04223.html#a572">x</a>->Parent); +00192 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (<a class="code" href="a04223.html#a572">x</a>->Parent->Parent); +00193 +00194 <a class="code" href="a04223.html#a572">x</a> = <a class="code" href="a04223.html#a572">x</a>->Parent->Parent; +00195 } +00196 <span class="keywordflow">else</span> +00197 { +00198 <span class="comment">// Uncle is Black</span> +00199 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a572">x</a> == <a class="code" href="a04223.html#a572">x</a>->Parent->Right) +00200 { +00201 <span class="comment">// Make x a left child</span> +00202 <a class="code" href="a04223.html#a572">x</a> = <a class="code" href="a04223.html#a572">x</a>->Parent; +00203 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord14">rotateLeft</a>(x); +00204 } +00205 +00206 <span class="comment">// Recolor and rotate</span> +00207 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack</a> (<a class="code" href="a04223.html#a572">x</a>->Parent); +00208 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh22">setNodeRed</a> (<a class="code" href="a04223.html#a572">x</a>->Parent->Parent); +00209 +00210 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord15">rotateRight</a> (<a class="code" href="a04223.html#a572">x</a>->Parent->Parent); +00211 +00212 <span class="comment">// Crc node</span> +00213 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (<a class="code" href="a04223.html#a572">x</a>->Parent); +00214 } +00215 } +00216 <span class="keywordflow">else</span> +00217 { +00218 <span class="comment">// Mirror image of above code</span> +00219 CHeapAllocator::CFreeNode *<a class="code" href="a04223.html#a573">y</a> = <a class="code" href="a04223.html#a572">x</a>->Parent->Parent->Left; +00220 <span class="keywordflow">if</span> (<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh14">isNodeRed</a> (y)) +00221 { +00222 <span class="comment">// Uncle is Red</span> +00223 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack</a> (<a class="code" href="a04223.html#a572">x</a>->Parent); +00224 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack</a> (y); +00225 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh22">setNodeRed</a> (<a class="code" href="a04223.html#a572">x</a>->Parent->Parent); +00226 +00227 <span class="comment">// Crc node</span> +00228 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (y); +00229 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (<a class="code" href="a04223.html#a572">x</a>->Parent); +00230 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (<a class="code" href="a04223.html#a572">x</a>->Parent->Parent); +00231 +00232 <a class="code" href="a04223.html#a572">x</a> = <a class="code" href="a04223.html#a572">x</a>->Parent->Parent; +00233 } +00234 <span class="keywordflow">else</span> +00235 { +00236 <span class="comment">// Uncle is Black</span> +00237 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a572">x</a> == <a class="code" href="a04223.html#a572">x</a>->Parent->Left) +00238 { +00239 <a class="code" href="a04223.html#a572">x</a> = <a class="code" href="a04223.html#a572">x</a>->Parent; +00240 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord15">rotateRight</a>(x); +00241 } +00242 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack</a> (<a class="code" href="a04223.html#a572">x</a>->Parent); +00243 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh22">setNodeRed</a> (<a class="code" href="a04223.html#a572">x</a>->Parent->Parent); +00244 +00245 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord14">rotateLeft</a> (<a class="code" href="a04223.html#a572">x</a>->Parent->Parent); +00246 +00247 <span class="comment">// Crc node</span> +00248 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (<a class="code" href="a04223.html#a572">x</a>->Parent); +00249 } +00250 } +00251 } +00252 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh18">setNodeBlack</a> (_FreeTreeRoot); +00253 +00254 <span class="comment">// Crc node</span> +00255 <a class="code" href="a04356.html#a2">NL_UPDATE_MAGIC_NUMBER_FREE_NODE</a> (_FreeTreeRoot); +00256 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatord10" doxytag="NLMISC::CHeapAllocator::internalCheckHeap" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CHeapAllocator::internalCheckHeap </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">bool </td> + <td class="mdname1" valign="top" nowrap> <em>stopOnError</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l02074">2074</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord0">checkFreeNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord2">checkNodeLB()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_1">checkNodeSB()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_6">getSmallBlock()</a>, <a class="el" href="a05779.html#l00032">internalAssert</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection()</a>, <a class="el" href="a05778.html#l00307">NLMISC::CHeapAllocator::CMainBlock::Next</a>, <a class="el" href="a05778.html#l00425">NLMISC::CHeapAllocator::CSmallBlockPool::Next</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a05776.html#l02050">checkHeap()</a>, and <a class="el" href="a05776.html#l00989">free()</a>. +<p> +<div class="fragment"><pre>02075 { +02076 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection</a> (); +02077 +02078 <span class="comment">// For each small blocks</span> +02079 CSmallBlockPool *pool = (CSmallBlockPool*)<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_4">_SmallBlockPool</a>; +02080 <span class="keywordflow">while</span> (pool) +02081 { +02082 <span class="comment">// For each small block</span> +02083 <a class="code" href="a04558.html#a15">uint</a> smallBlock; +02084 CNodeBegin *previous = NULL; +02085 <span class="keywordflow">for</span> (smallBlock=0; smallBlock<<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_0NLMISC_1_1CHeapAllocatorw14">SmallBlockPoolSize</a>; smallBlock++) +02086 { +02087 <span class="comment">// Get the small block</span> +02088 CNodeBegin *node = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_6">getSmallBlock</a> (pool, smallBlock); +02089 CNodeBegin *next = (smallBlock+1<SmallBlockPoolSize) ? <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_6">getSmallBlock</a> (pool, smallBlock+1) : NULL; +02090 +02091 <span class="comment">// Check node</span> +02092 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_1">checkNodeSB</a> (pool, previous, node, next, stopOnError); +02093 +02094 previous = node; +02095 } +02096 +02097 <span class="comment">// Next pool</span> +02098 pool = pool->Next; +02099 } +02100 +02101 <span class="comment">// For each main block</span> +02102 CMainBlock *currentBlock = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr5">_MainBlockList</a>; +02103 <span class="keywordflow">while</span> (currentBlock) +02104 { +02105 <span class="comment">// Get the nodes</span> +02106 <span class="keyword">const</span> CNodeBegin *previous = NULL; +02107 <span class="keyword">const</span> CNodeBegin *current = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh3">getFirstNode</a> (currentBlock); +02108 <a class="code" href="a04356.html#a0">internalAssert</a> (current); <span class="comment">// Should have at least one block in the main block</span> +02109 <span class="keyword">const</span> CNodeBegin *next; +02110 +02111 <span class="comment">// For each node</span> +02112 <span class="keywordflow">while</span> (current) +02113 { +02114 <span class="comment">// Get next</span> +02115 next = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode</a> (current); +02116 +02117 <span class="comment">// Return Error ?</span> +02118 <span class="keywordflow">if</span> (!<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord2">checkNodeLB</a> (currentBlock, previous, current, next, stopOnError)) +02119 <span class="keywordflow">return</span> <span class="keyword">false</span>; +02120 +02121 <span class="comment">// Next</span> +02122 previous = current; +02123 current = next; +02124 } +02125 +02126 <span class="comment">// Next block</span> +02127 currentBlock = currentBlock->Next; +02128 } +02129 +02130 <span class="comment">// Check free tree</span> +02131 <span class="keywordflow">if</span> (!<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord0">checkFreeNode</a> (_FreeTreeRoot, stopOnError, <span class="keyword">true</span>)) +02132 <span class="keywordflow">return</span> <span class="keyword">false</span>; +02133 +02134 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection</a> (); +02135 +02136 <span class="comment">// Ok, no problem</span> +02137 <span class="keywordflow">return</span> <span class="keyword">true</span>; +02138 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh11" doxytag="NLMISC::CHeapAllocator::isNodeBlack" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CHeapAllocator::isNodeBlack </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02613.html">CFreeNode</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>current</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l00260">erase()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh12" doxytag="NLMISC::CHeapAllocator::isNodeFree" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CHeapAllocator::isNodeFree </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>current</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l01393">debugStatisticsReport()</a>, <a class="el" href="a05776.html#l00989">free()</a>, and <a class="el" href="a05776.html#l01685">getFreeMemory()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh13" doxytag="NLMISC::CHeapAllocator::isNodeLast" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CHeapAllocator::isNodeLast </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>current</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh14" doxytag="NLMISC::CHeapAllocator::isNodeRed" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CHeapAllocator::isNodeRed </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02613.html">CFreeNode</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>current</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l00260">erase()</a>, and <a class="el" href="a05776.html#l00137">insert()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh15" doxytag="NLMISC::CHeapAllocator::isNodeSmall" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CHeapAllocator::isNodeSmall </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>current</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh16" doxytag="NLMISC::CHeapAllocator::isNodeUsed" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CHeapAllocator::isNodeUsed </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>current</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l01245">debugGetAllocatedMemoryByCategory()</a>, <a class="el" href="a05776.html#l01916">debugReportMemoryLeak()</a>, <a class="el" href="a05776.html#l01393">debugStatisticsReport()</a>, <a class="el" href="a05776.html#l01181">getAllocatedMemory()</a>, and <a class="el" href="a05776.html#l01804">getFragmentationRatio()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatord11" doxytag="NLMISC::CHeapAllocator::leaveCriticalSection" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::leaveCriticalSection </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l00071">CHeapAllocator()</a>, <a class="el" href="a05776.html#l01245">debugGetAllocatedMemoryByCategory()</a>, <a class="el" href="a05776.html#l01310">debugGetLBDebugInfoSize()</a>, <a class="el" href="a05776.html#l01342">debugGetSBDebugInfoSize()</a>, <a class="el" href="a05776.html#l01845">freeAll()</a>, <a class="el" href="a05776.html#l01181">getAllocatedMemory()</a>, <a class="el" href="a05776.html#l01804">getFragmentationRatio()</a>, <a class="el" href="a05776.html#l01685">getFreeMemory()</a>, <a class="el" href="a05776.html#l01777">getSmallBlockMemory()</a>, <a class="el" href="a05776.html#l01748">getTotalMemoryUsed()</a>, <a class="el" href="a05776.html#l02074">internalCheckHeap()</a>, <a class="el" href="a05776.html#l01879">releaseMemory()</a>, and <a class="el" href="a05776.html#l02160">setName()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatord12" doxytag="NLMISC::CHeapAllocator::leaveCriticalSectionLB" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::leaveCriticalSectionLB </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l00989">free()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatord13" doxytag="NLMISC::CHeapAllocator::leaveCriticalSectionSB" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::leaveCriticalSectionSB </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l00989">free()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh17" doxytag="NLMISC::CHeapAllocator::mergeNode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::mergeNode </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>node</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l00527">527</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize()</a>, <a class="el" href="a05779.html#l00032">internalAssert</a>, <a class="el" href="a05777.html#l00324">NL_HEAP_NODE_END_SIZE</a>, <a class="el" href="a05779.html#l00042">NL_UPDATE_MAGIC_NUMBER</a>, <a class="el" href="a05778.html#l00253">NLMISC::CHeapAllocator::CNodeBegin::Previous</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh21">setNodeLast()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh23">setNodeSize()</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05776.html#l00989">free()</a>. +<p> +<div class="fragment"><pre>00528 { +00529 <span class="comment">// Get the previous node to merge with</span> +00530 CNodeBegin *previous = node->Previous; +00531 <a class="code" href="a04356.html#a0">internalAssert</a> (getNextNode (previous) == node); +00532 <a class="code" href="a04356.html#a0">internalAssert</a> (previous); +00533 <a class="code" href="a04356.html#a0">internalAssert</a> (isNodeFree (previous)); +00534 +00535 <span class="comment">// New size</span> +00536 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh23">setNodeSize</a> (previous, getNodeSize (previous) + getNodeSize (node) + <span class="keyword">sizeof</span> (CNodeBegin) + NL_HEAP_NODE_END_SIZE); +00537 +00538 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00539 <span class="preprocessor"></span> <span class="comment">// Set end pointers</span> +00540 previous->EndMagicNumber = (<a class="code" href="a04558.html#a11">uint32</a>*)((<a class="code" href="a04558.html#a7">uint8</a>*)previous + <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (previous) + <span class="keyword">sizeof</span> (CNodeBegin)); +00541 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00542 <span class="preprocessor"></span> +00543 <span class="comment">// Get the next node to relink</span> +00544 CNodeBegin *next = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode</a> (node); +00545 <span class="keywordflow">if</span> (next) +00546 { +00547 <span class="comment">// Relink</span> +00548 next->Previous = previous; +00549 +00550 <a class="code" href="a04356.html#a1">NL_UPDATE_MAGIC_NUMBER</a> (next); +00551 } +00552 +00553 <span class="comment">// Get the last flag</span> +00554 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh21">setNodeLast</a> (previous, isNodeLast (node)); +00555 +00556 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00557 <span class="preprocessor"></span> +00558 <span class="comment">// todo align</span> +00559 +00560 <span class="comment">// Clear the node informations</span> +00561 memset (((<a class="code" href="a04558.html#a7">uint8</a>*)node + getNodeSize (node) + <span class="keyword">sizeof</span> (CNodeBegin)), DeletedMemory, NL_HEAP_NODE_END_SIZE); +00562 memset (node, DeletedMemory, <span class="keyword">sizeof</span> (CNodeBegin)); +00563 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00564 <span class="preprocessor"></span>} +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora26" doxytag="NLMISC::CHeapAllocator::reallocate" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void* NLMISC::CHeapAllocator::reallocate </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">void * </td> + <td class="mdname" nowrap> <em>ptr</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>size</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const char * </td> + <td class="mdname" nowrap> <em>sourceFile</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>line</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const char * </td> + <td class="mdname" nowrap> <em>category</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora27" doxytag="NLMISC::CHeapAllocator::releaseMemory" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::releaseMemory </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l01879">1879</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection()</a>, <a class="el" href="a05776.html#l02067">freeBlock()</a>, <a class="el" href="a05778.html#l00372">NLMISC::CHeapAllocator::CNullNode::FreeNode</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection()</a>, <a class="el" href="a05778.html#l00307">NLMISC::CHeapAllocator::CMainBlock::Next</a>, and <a class="el" href="a05778.html#l00306">NLMISC::CHeapAllocator::CMainBlock::Ptr</a>. +<p> +Referenced by <a class="el" href="a05776.html#l00129">~CHeapAllocator()</a>. +<p> +<div class="fragment"><pre>01880 { +01881 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection</a> (); +01882 +01883 <span class="comment">// Clear the free tree</span> +01884 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr4">_FreeTreeRoot</a> = &<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr9">_NullNode</a>.<a class="code" href="a02623.html#NLMISC_1_1CHeapAllocator_1_1CNullNodeo0">FreeNode</a>; +01885 +01886 <span class="comment">// For each main block</span> +01887 CMainBlock *currentBlock = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorr5">_MainBlockList</a>; +01888 <span class="keywordflow">while</span> (currentBlock) +01889 { +01890 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatora14">freeBlock</a> (currentBlock->Ptr); +01891 +01892 <span class="comment">// Next block</span> +01893 CMainBlock *toDelete = currentBlock; +01894 currentBlock = toDelete->Next; +01895 ::free (toDelete); +01896 } +01897 +01898 <span class="comment">// Erase block node</span> +01899 _MainBlockList = NULL; +01900 +01901 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection</a> (); +01902 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatord14" doxytag="NLMISC::CHeapAllocator::rotateLeft" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::rotateLeft </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02613.html">CFreeNode</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>x</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l00260">erase()</a>, and <a class="el" href="a05776.html#l00137">insert()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatord15" doxytag="NLMISC::CHeapAllocator::rotateRight" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::rotateRight </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02613.html">CFreeNode</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>x</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l00260">erase()</a>, and <a class="el" href="a05776.html#l00137">insert()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora28" doxytag="NLMISC::CHeapAllocator::setBlockAllocationMode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::setBlockAllocationMode </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw15">TBlockAllocationMode</a> </td> + <td class="mdname1" valign="top" nowrap> <em>mode</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora29" doxytag="NLMISC::CHeapAllocator::setMainBlockCount" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CHeapAllocator::setMainBlockCount </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname1" valign="top" nowrap> <em>blockCount</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora30" doxytag="NLMISC::CHeapAllocator::setMainBlockSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CHeapAllocator::setMainBlockSize </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname1" valign="top" nowrap> <em>mainBlockSize</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora31" doxytag="NLMISC::CHeapAllocator::setName" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::setName </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const char * </td> + <td class="mdname1" valign="top" nowrap> <em>name</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l02160">2160</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection()</a>, and <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection()</a>. +<p> +<div class="fragment"><pre>02161 { +02162 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord3">enterCriticalSection</a> (); +02163 +02164 strncpy (_Name, name, NameLength-1); +02165 +02166 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatord11">leaveCriticalSection</a> (); +02167 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorz1952_7" doxytag="NLMISC::CHeapAllocator::setNextSmallBlock" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::setNextSmallBlock </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname" nowrap> <em>previous</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname" nowrap> <em>next</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh18" doxytag="NLMISC::CHeapAllocator::setNodeBlack" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::setNodeBlack </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02613.html">CFreeNode</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>current</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l00071">CHeapAllocator()</a>, <a class="el" href="a05776.html#l00260">erase()</a>, and <a class="el" href="a05776.html#l00137">insert()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh19" doxytag="NLMISC::CHeapAllocator::setNodeColor" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::setNodeColor </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02613.html">CFreeNode</a> * </td> + <td class="mdname" nowrap> <em>current</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>red</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l00260">erase()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh20" doxytag="NLMISC::CHeapAllocator::setNodeFree" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::setNodeFree </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>current</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l00989">free()</a>, <a class="el" href="a05776.html#l00576">initEmptyBlock()</a>, and <a class="el" href="a05776.html#l00442">splitNode()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh21" doxytag="NLMISC::CHeapAllocator::setNodeLast" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::setNodeLast </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname" nowrap> <em>current</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>last</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l00576">initEmptyBlock()</a>, <a class="el" href="a05776.html#l00527">mergeNode()</a>, and <a class="el" href="a05776.html#l00442">splitNode()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh22" doxytag="NLMISC::CHeapAllocator::setNodeRed" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::setNodeRed </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02613.html">CFreeNode</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>current</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l00260">erase()</a>, and <a class="el" href="a05776.html#l00137">insert()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh23" doxytag="NLMISC::CHeapAllocator::setNodeSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::setNodeSize </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname" nowrap> <em>current</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>size</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a05776.html#l00576">initEmptyBlock()</a>, <a class="el" href="a05776.html#l00527">mergeNode()</a>, and <a class="el" href="a05776.html#l00442">splitNode()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorh24" doxytag="NLMISC::CHeapAllocator::setNodeUsed" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::setNodeUsed </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>current</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatora32" doxytag="NLMISC::CHeapAllocator::setOutOfMemoryMode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CHeapAllocator::setOutOfMemoryMode </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw18">TOutOfMemoryMode</a> </td> + <td class="mdname1" valign="top" nowrap> <em>mode</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatord16" doxytag="NLMISC::CHeapAllocator::splitNode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02619.html">CHeapAllocator::CNodeBegin</a> * NLMISC::CHeapAllocator::splitNode </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02619.html">CNodeBegin</a> * </td> + <td class="mdname" nowrap> <em>node</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>newSize</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [inline, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05776.html#l00442">442</a> of file <a class="el" href="a05776.html">misc/heap_allocator.cpp</a>. +<p> +References <a class="el" href="a05778.html#l00243">NLMISC::CHeapAllocator::CNodeBegin::BeginMarkers</a>, <a class="el" href="a05778.html#l00245">NLMISC::CHeapAllocator::CNodeBegin::Category</a>, <a class="el" href="a05778.html#l00248">NLMISC::CHeapAllocator::CNodeBegin::EndMagicNumber</a>, <a class="el" href="a05778.html#l00265">NLMISC::CHeapAllocator::CNodeEnd::EndMarkers</a>, <a class="el" href="a05778.html#l00246">NLMISC::CHeapAllocator::CNodeBegin::File</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize()</a>, <a class="el" href="a05778.html#l00247">NLMISC::CHeapAllocator::CNodeBegin::Heap</a>, <a class="el" href="a05779.html#l00032">internalAssert</a>, <a class="el" href="a05778.html#l00244">NLMISC::CHeapAllocator::CNodeBegin::Line</a>, <a class="el" href="a05777.html#l00324">NL_HEAP_NODE_END_SIZE</a>, <a class="el" href="a05779.html#l00042">NL_UPDATE_MAGIC_NUMBER</a>, <a class="el" href="a05778.html#l00253">NLMISC::CHeapAllocator::CNodeBegin::Previous</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh20">setNodeFree()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh21">setNodeLast()</a>, <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorh23">setNodeSize()</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>00443 { +00444 <span class="comment">// Should be smaller than node size</span> +00445 <a class="code" href="a04356.html#a0">internalAssert</a> (newSize <= getNodeSize (node)); +00446 +00447 <span class="comment">// Align size</span> +00448 <a class="code" href="a04558.html#a15">uint</a> allignedSize = (newSize&~(<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatory1NLMISC_1_1CHeapAllocatory3">Align</a>-1)) + (( (newSize&(<a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatory1NLMISC_1_1CHeapAllocatory3">Align</a>-1))==0 ) ? 0 : <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatory1NLMISC_1_1CHeapAllocatory3">Align</a>); +00449 <span class="keywordflow">if</span> (allignedSize <= <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatory2NLMISC_1_1CHeapAllocatory8">UserDataBlockSizeMin</a>) +00450 allignedSize = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatory2NLMISC_1_1CHeapAllocatory8">UserDataBlockSizeMin</a>; +00451 +00452 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00453 <span class="preprocessor"></span> <span class="comment">// End magic number aligned on new size</span> +00454 node->EndMagicNumber = (<a class="code" href="a04558.html#a11">uint32</a>*)((<a class="code" href="a04558.html#a7">uint8</a>*)node + newSize + <span class="keyword">sizeof</span> (CNodeBegin)); +00455 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00456 <span class="preprocessor"></span> +00457 <span class="comment">// Rest is empty ?</span> +00458 <span class="keywordflow">if</span> ( <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (node) - allignedSize < UserDataBlockSizeMin + <span class="keyword">sizeof</span> (CNodeBegin) + <a class="code" href="a04354.html#a2">NL_HEAP_NODE_END_SIZE</a> ) +00459 <span class="comment">// No split</span> +00460 <span class="keywordflow">return</span> NULL; +00461 +00462 <span class="comment">// New node begin structure</span> +00463 CNodeBegin *newNode = (CNodeBegin*)((<a class="code" href="a04558.html#a7">uint8</a>*)node + <span class="keyword">sizeof</span> (CNodeBegin) + allignedSize + <a class="code" href="a04354.html#a2">NL_HEAP_NODE_END_SIZE</a> ); +00464 +00465 <span class="comment">// Fill the new node header</span> +00466 +00467 <span class="comment">// Size</span> +00468 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh23">setNodeSize</a> (newNode, getNodeSize (node) - allignedSize - <span class="keyword">sizeof</span> (CNodeBegin) - NL_HEAP_NODE_END_SIZE); +00469 +00470 <span class="comment">// Set the node free</span> +00471 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh20">setNodeFree</a> (newNode); +00472 +00473 <span class="comment">// Set the previous node pointer</span> +00474 newNode->Previous = node; +00475 +00476 <span class="comment">// Last flag</span> +00477 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh21">setNodeLast</a> (newNode, isNodeLast (node)); +00478 +00479 <span class="preprocessor">#ifndef NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00480 <span class="preprocessor"></span> <span class="comment">// Begin markers</span> +00481 memset (newNode->BeginMarkers, BeginNodeMarkers, CNodeBegin::MarkerSize-1); +00482 newNode->BeginMarkers[CNodeBegin::MarkerSize-1] = 0; +00483 +00484 <span class="comment">// End pointer</span> +00485 newNode->EndMagicNumber = (<a class="code" href="a04558.html#a11">uint32</a>*)((<a class="code" href="a04558.html#a7">uint8</a>*)newNode + <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (newNode) + <span class="keyword">sizeof</span> (CNodeBegin)); +00486 +00487 <span class="comment">// End markers</span> +00488 CNodeEnd *endNode = (CNodeEnd*)((<a class="code" href="a04558.html#a7">uint8</a>*)newNode + <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh10">getNodeSize</a> (newNode) + <span class="keyword">sizeof</span> (CNodeBegin)); +00489 memset (endNode->EndMarkers, EndNodeMarkers, CNodeEnd::MarkerSize-1); +00490 endNode->EndMarkers[CNodeEnd::MarkerSize-1] = 0; +00491 +00492 <span class="comment">// No source informations</span> +00493 newNode->File = NULL; +00494 newNode->Line = 0xffff; +00495 node->AllocateNumber = 0xffffffff; +00496 memset (newNode->Category, 0, CategoryStringLength); +00497 +00498 <span class="comment">// Heap pointer</span> +00499 newNode->Heap = <span class="keyword">this</span>; +00500 <span class="preprocessor">#endif // NLMISC_HEAP_ALLOCATION_NDEBUG</span> +00501 <span class="preprocessor"></span> +00502 <span class="comment">// Get next node</span> +00503 CNodeBegin *next = <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh7">getNextNode</a> (node); +00504 <span class="keywordflow">if</span> (next) +00505 { +00506 <span class="comment">// Set previous</span> +00507 next->Previous = newNode; +00508 +00509 <a class="code" href="a04356.html#a1">NL_UPDATE_MAGIC_NUMBER</a> (next); +00510 } +00511 +00512 <span class="comment">// Should be big enough</span> +00513 <a class="code" href="a04356.html#a0">internalAssert</a> (getNodeSize (newNode) >= UserDataBlockSizeMin); +00514 +00515 <span class="comment">// New size of the first node</span> +00516 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh23">setNodeSize</a> (node, allignedSize); +00517 +00518 <span class="comment">// No more the last</span> +00519 <a class="code" href="a02609.html#NLMISC_1_1CHeapAllocatorh21">setNodeLast</a> (node, <span class="keyword">false</span>); +00520 +00521 <span class="comment">// Return new node</span> +00522 <span class="keywordflow">return</span> newNode; +00523 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorr0" doxytag="NLMISC::CHeapAllocator::_AllocateCount" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr0">NLMISC::CHeapAllocator::_AllocateCount</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05778.html#l00393">393</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorr1" doxytag="NLMISC::CHeapAllocator::_AlwaysCheck" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr1">NLMISC::CHeapAllocator::_AlwaysCheck</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05778.html#l00380">380</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorr2" doxytag="NLMISC::CHeapAllocator::_BlockAllocationMode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw15">TBlockAllocationMode</a> <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr2">NLMISC::CHeapAllocator::_BlockAllocationMode</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05778.html#l00377">377</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorr3" doxytag="NLMISC::CHeapAllocator::_BlockCount" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr3">NLMISC::CHeapAllocator::_BlockCount</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05778.html#l00376">376</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorz1953_2" doxytag="NLMISC::CHeapAllocator::_CategoryStack" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03473.html">CTDS</a> <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1953_2">NLMISC::CHeapAllocator::_CategoryStack</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05778.html#l00479">479</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorz1952_2" doxytag="NLMISC::CHeapAllocator::_FreeSmallBlocks" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> volatile <a class="el" href="a02619.html">CNodeBegin</a>* <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_2">NLMISC::CHeapAllocator::_FreeSmallBlocks</a>[ (1+(LastSmallBlock - FirstSmallBlock)/SmallBlockGranularity) ]<code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05778.html#l00452">452</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorr4" doxytag="NLMISC::CHeapAllocator::_FreeTreeRoot" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02613.html">CFreeNode</a>* <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr4">NLMISC::CHeapAllocator::_FreeTreeRoot</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05778.html#l00387">387</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorr5" doxytag="NLMISC::CHeapAllocator::_MainBlockList" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02615.html">CMainBlock</a>* <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr5">NLMISC::CHeapAllocator::_MainBlockList</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05778.html#l00384">384</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorr6" doxytag="NLMISC::CHeapAllocator::_MainBlockSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr6">NLMISC::CHeapAllocator::_MainBlockSize</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05778.html#l00375">375</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorr7" doxytag="NLMISC::CHeapAllocator::_MutexLB" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02516.html">CAllocatorMutex</a> <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr7">NLMISC::CHeapAllocator::_MutexLB</a><code> [mutable, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05778.html#l00389">389</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorz1952_3" doxytag="NLMISC::CHeapAllocator::_MutexSB" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02516.html">CAllocatorMutex</a> <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_3">NLMISC::CHeapAllocator::_MutexSB</a><code> [mutable, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05778.html#l00455">455</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorr8" doxytag="NLMISC::CHeapAllocator::_Name" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> char <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr8">NLMISC::CHeapAllocator::_Name</a>[NameLength]<code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05778.html#l00391">391</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorr9" doxytag="NLMISC::CHeapAllocator::_NullNode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02623.html">CNullNode</a> <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr9">NLMISC::CHeapAllocator::_NullNode</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05778.html#l00388">388</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorr10" doxytag="NLMISC::CHeapAllocator::_OutOfMemoryMode" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorw18">TOutOfMemoryMode</a> <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorr10">NLMISC::CHeapAllocator::_OutOfMemoryMode</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05778.html#l00378">378</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CHeapAllocatorz1952_4" doxytag="NLMISC::CHeapAllocator::_SmallBlockPool" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> volatile <a class="el" href="a02625.html">CSmallBlockPool</a>* <a class="el" href="a02609.html#NLMISC_1_1CHeapAllocatorz1952_4">NLMISC::CHeapAllocator::_SmallBlockPool</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05778.html#l00453">453</a> of file <a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a05778.html">include/nel/misc/heap_allocator.h</a><li><a class="el" href="a05776.html">misc/heap_allocator.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 13:16:09 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |