<!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>Apache Portable Runtime: Internal Memory Allocation</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.4.7 --> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> </ul></div> <h1>Internal Memory Allocation<br> <small> [<a class="el" href="group___a_p_r.html">Apache Portability Runtime library</a>]</small> </h1><table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Data Structures</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><a class="el" href="structapr__memnode__t.html">apr_memnode_t</a></td></tr> <tr><td colspan="2"><br><h2>Defines</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__allocator.html#g7f933e0b0e6f21efb6df549addc1e093">APR_MEMNODE_T_SIZE</a> APR_ALIGN_DEFAULT(sizeof(<a class="el" href="structapr__memnode__t.html">apr_memnode_t</a>))</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__allocator.html#gefd8201346ebf6a861403a2a7375a4ab">APR_ALLOCATOR_MAX_FREE_UNLIMITED</a> 0</td></tr> <tr><td colspan="2"><br><h2>Typedefs</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <a class="el" href="structapr__memnode__t.html">apr_memnode_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__allocator.html#g47206d3fcfa9590aed7f97d943501061">apr_memnode_t</a></td></tr> <tr><td colspan="2"><br><h2>Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__apr__errno.html#g4cf2ddae3efce70c508ac7fefc1c47f7">apr_status_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__allocator.html#gc6108c8fbaaf4fa8588a2384851b41c8">apr_allocator_create</a> (<a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> **allocator)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__allocator.html#g95e2688f7e95f3717cf47d2ebc8695af">apr_allocator_destroy</a> (<a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> *allocator)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="structapr__memnode__t.html">apr_memnode_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__allocator.html#g1faf4ae0fdffe952b0a80d272ab02654">apr_allocator_alloc</a> (<a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> *allocator, apr_size_t size)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__allocator.html#gbe55fa0b1926a78576341e323172d08c">apr_allocator_free</a> (<a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> *allocator, <a class="el" href="structapr__memnode__t.html">apr_memnode_t</a> *memnode)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__allocator.html#gb597ff70e47bae2e3281ed478332c3e0">apr_allocator_owner_set</a> (<a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> *allocator, <a class="el" href="group__apr__pools.html#g06f17a7732f2d04d8ce7010fbb057a8b">apr_pool_t</a> *pool)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__apr__pools.html#g06f17a7732f2d04d8ce7010fbb057a8b">apr_pool_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__allocator.html#gd575130bfe7623016f5fbbf1105298a2">apr_allocator_owner_get</a> (<a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> *allocator)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__allocator.html#g4dadecb6049bb67fd90546e06cbb19b2">apr_allocator_max_free_set</a> (<a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> *allocator, apr_size_t size)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__allocator.html#g7bebc126d56d3cabcb80b4f075d051cb">apr_allocator_mutex_set</a> (<a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> *allocator, <a class="el" href="group__apr__thread__mutex.html#g403b0b4658868d93e2b773e671ef06a7">apr_thread_mutex_t</a> *mutex)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__apr__thread__mutex.html#g403b0b4658868d93e2b773e671ef06a7">apr_thread_mutex_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__allocator.html#gac49660a18991c085ab1a9d4816c511a">apr_allocator_mutex_get</a> (<a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> *allocator)</td></tr> </table> <hr><h2>Define Documentation</h2> <a class="anchor" name="gefd8201346ebf6a861403a2a7375a4ab"></a><!-- doxytag: member="apr_allocator.h::APR_ALLOCATOR_MAX_FREE_UNLIMITED" ref="gefd8201346ebf6a861403a2a7375a4ab" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define APR_ALLOCATOR_MAX_FREE_UNLIMITED 0 </td> </tr> </table> </div> <div class="memdoc"> <p> Symbolic constants </div> </div><p> <a class="anchor" name="g7f933e0b0e6f21efb6df549addc1e093"></a><!-- doxytag: member="apr_allocator.h::APR_MEMNODE_T_SIZE" ref="g7f933e0b0e6f21efb6df549addc1e093" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define APR_MEMNODE_T_SIZE APR_ALIGN_DEFAULT(sizeof(<a class="el" href="structapr__memnode__t.html">apr_memnode_t</a>)) </td> </tr> </table> </div> <div class="memdoc"> <p> The base size of a memory node - aligned. </div> </div><p> <hr><h2>Typedef Documentation</h2> <a class="anchor" name="g7c54745bdc959966aef3b262ce2d1503"></a><!-- doxytag: member="apr_allocator.h::apr_allocator_t" ref="g7c54745bdc959966aef3b262ce2d1503" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef struct <a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> <a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> </td> </tr> </table> </div> <div class="memdoc"> <p> the allocator structure </div> </div><p> <a class="anchor" name="g47206d3fcfa9590aed7f97d943501061"></a><!-- doxytag: member="apr_allocator.h::apr_memnode_t" ref="g47206d3fcfa9590aed7f97d943501061" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef struct <a class="el" href="structapr__memnode__t.html">apr_memnode_t</a> <a class="el" href="structapr__memnode__t.html">apr_memnode_t</a> </td> </tr> </table> </div> <div class="memdoc"> <p> the structure which holds information about the allocation </div> </div><p> <hr><h2>Function Documentation</h2> <a class="anchor" name="g1faf4ae0fdffe952b0a80d272ab02654"></a><!-- doxytag: member="apr_allocator.h::apr_allocator_alloc" ref="g1faf4ae0fdffe952b0a80d272ab02654" args="(apr_allocator_t *allocator, apr_size_t size)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="structapr__memnode__t.html">apr_memnode_t</a>* apr_allocator_alloc </td> <td>(</td> <td class="paramtype"><a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> * </td> <td class="paramname"> <em>allocator</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">apr_size_t </td> <td class="paramname"> <em>size</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Allocate a block of mem from the allocator <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>allocator</em> </td><td>The allocator to allocate from </td></tr> <tr><td valign="top"></td><td valign="top"><em>size</em> </td><td>The size of the mem to allocate (excluding the memnode structure) </td></tr> </table> </dl> </div> </div><p> <a class="anchor" name="gc6108c8fbaaf4fa8588a2384851b41c8"></a><!-- doxytag: member="apr_allocator.h::apr_allocator_create" ref="gc6108c8fbaaf4fa8588a2384851b41c8" args="(apr_allocator_t **allocator)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="group__apr__errno.html#g4cf2ddae3efce70c508ac7fefc1c47f7">apr_status_t</a> apr_allocator_create </td> <td>(</td> <td class="paramtype"><a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> ** </td> <td class="paramname"> <em>allocator</em> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Create a new allocator <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>allocator</em> </td><td>The allocator we have just created. </td></tr> </table> </dl> </div> </div><p> <a class="anchor" name="g95e2688f7e95f3717cf47d2ebc8695af"></a><!-- doxytag: member="apr_allocator.h::apr_allocator_destroy" ref="g95e2688f7e95f3717cf47d2ebc8695af" args="(apr_allocator_t *allocator)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void apr_allocator_destroy </td> <td>(</td> <td class="paramtype"><a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> * </td> <td class="paramname"> <em>allocator</em> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Destroy an allocator <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>allocator</em> </td><td>The allocator to be destroyed </td></tr> </table> </dl> <dl compact><dt><b>Remarks:</b></dt><dd>Any memnodes not given back to the allocator prior to destroying will _not_ be free()d. </dd></dl> </div> </div><p> <a class="anchor" name="gbe55fa0b1926a78576341e323172d08c"></a><!-- doxytag: member="apr_allocator.h::apr_allocator_free" ref="gbe55fa0b1926a78576341e323172d08c" args="(apr_allocator_t *allocator, apr_memnode_t *memnode)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void apr_allocator_free </td> <td>(</td> <td class="paramtype"><a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> * </td> <td class="paramname"> <em>allocator</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="structapr__memnode__t.html">apr_memnode_t</a> * </td> <td class="paramname"> <em>memnode</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Free a list of blocks of mem, giving them back to the allocator. The list is typically terminated by a memnode with its next field set to NULL. <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>allocator</em> </td><td>The allocator to give the mem back to </td></tr> <tr><td valign="top"></td><td valign="top"><em>memnode</em> </td><td>The memory node to return </td></tr> </table> </dl> </div> </div><p> <a class="anchor" name="g4dadecb6049bb67fd90546e06cbb19b2"></a><!-- doxytag: member="apr_allocator.h::apr_allocator_max_free_set" ref="g4dadecb6049bb67fd90546e06cbb19b2" args="(apr_allocator_t *allocator, apr_size_t size)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void apr_allocator_max_free_set </td> <td>(</td> <td class="paramtype"><a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> * </td> <td class="paramname"> <em>allocator</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">apr_size_t </td> <td class="paramname"> <em>size</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Set the current threshold at which the allocator should start giving blocks back to the system. <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>allocator</em> </td><td>The allocator the set the threshold on </td></tr> <tr><td valign="top"></td><td valign="top"><em>size</em> </td><td>The threshold. 0 == unlimited. </td></tr> </table> </dl> </div> </div><p> <a class="anchor" name="gac49660a18991c085ab1a9d4816c511a"></a><!-- doxytag: member="apr_allocator.h::apr_allocator_mutex_get" ref="gac49660a18991c085ab1a9d4816c511a" args="(apr_allocator_t *allocator)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="group__apr__thread__mutex.html#g403b0b4658868d93e2b773e671ef06a7">apr_thread_mutex_t</a>* apr_allocator_mutex_get </td> <td>(</td> <td class="paramtype"><a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> * </td> <td class="paramname"> <em>allocator</em> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Get the mutex currently set for the allocator <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>allocator</em> </td><td>The allocator </td></tr> </table> </dl> </div> </div><p> <a class="anchor" name="g7bebc126d56d3cabcb80b4f075d051cb"></a><!-- doxytag: member="apr_allocator.h::apr_allocator_mutex_set" ref="g7bebc126d56d3cabcb80b4f075d051cb" args="(apr_allocator_t *allocator, apr_thread_mutex_t *mutex)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void apr_allocator_mutex_set </td> <td>(</td> <td class="paramtype"><a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> * </td> <td class="paramname"> <em>allocator</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="group__apr__thread__mutex.html#g403b0b4658868d93e2b773e671ef06a7">apr_thread_mutex_t</a> * </td> <td class="paramname"> <em>mutex</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Set a mutex for the allocator to use <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>allocator</em> </td><td>The allocator to set the mutex for </td></tr> <tr><td valign="top"></td><td valign="top"><em>mutex</em> </td><td>The mutex </td></tr> </table> </dl> </div> </div><p> <a class="anchor" name="gd575130bfe7623016f5fbbf1105298a2"></a><!-- doxytag: member="apr_allocator.h::apr_allocator_owner_get" ref="gd575130bfe7623016f5fbbf1105298a2" args="(apr_allocator_t *allocator)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="group__apr__pools.html#g06f17a7732f2d04d8ce7010fbb057a8b">apr_pool_t</a>* apr_allocator_owner_get </td> <td>(</td> <td class="paramtype"><a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> * </td> <td class="paramname"> <em>allocator</em> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Get the current owner of the allocator <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>allocator</em> </td><td>The allocator to get the owner from </td></tr> </table> </dl> </div> </div><p> <a class="anchor" name="gb597ff70e47bae2e3281ed478332c3e0"></a><!-- doxytag: member="apr_allocator.h::apr_allocator_owner_set" ref="gb597ff70e47bae2e3281ed478332c3e0" args="(apr_allocator_t *allocator, apr_pool_t *pool)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void apr_allocator_owner_set </td> <td>(</td> <td class="paramtype"><a class="el" href="group__apr__allocator.html#g7c54745bdc959966aef3b262ce2d1503">apr_allocator_t</a> * </td> <td class="paramname"> <em>allocator</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="group__apr__pools.html#g06f17a7732f2d04d8ce7010fbb057a8b">apr_pool_t</a> * </td> <td class="paramname"> <em>pool</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Set the owner of the allocator <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>allocator</em> </td><td>The allocator to set the owner for </td></tr> <tr><td valign="top"></td><td valign="top"><em>pool</em> </td><td>The pool that is to own the allocator </td></tr> </table> </dl> <dl compact><dt><b>Remarks:</b></dt><dd>Typically pool is the highest level pool using the allocator </dd></dl> </div> </div><p> <hr size="1"><address style="align: right;"><small>Generated on Tue May 31 12:20:26 2011 for Apache Portable Runtime by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address> </body> </html>