<!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"> </head><body> <!-- Generated by Doxygen 1.3.9.1 --> <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</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></div> <h1>Internal Memory Allocation<br> <small> [<a class="el" href="group__APR.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#ga11">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#ga12">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#ga0">apr_allocator_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__allocator.html#ga0">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#ga1">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#ga0">apr_status_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__allocator.html#ga2">apr_allocator_create</a> (<a class="el" href="group__apr__allocator.html#ga0">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#ga3">apr_allocator_destroy</a> (<a class="el" href="group__apr__allocator.html#ga0">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#ga4">apr_allocator_alloc</a> (<a class="el" href="group__apr__allocator.html#ga0">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#ga5">apr_allocator_free</a> (<a class="el" href="group__apr__allocator.html#ga0">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#ga6">apr_allocator_owner_set</a> (<a class="el" href="group__apr__allocator.html#ga0">apr_allocator_t</a> *allocator, <a class="el" href="group__apr__pools.html#ga0">apr_pool_t</a> *pool)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__apr__pools.html#ga0">apr_pool_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__allocator.html#ga7">apr_allocator_owner_get</a> (<a class="el" href="group__apr__allocator.html#ga0">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#ga8">apr_allocator_max_free_set</a> (<a class="el" href="group__apr__allocator.html#ga0">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#ga9">apr_allocator_mutex_set</a> (<a class="el" href="group__apr__allocator.html#ga0">apr_allocator_t</a> *allocator, <a class="el" href="group__apr__thread__mutex.html#ga0">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#ga0">apr_thread_mutex_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__apr__allocator.html#ga10">apr_allocator_mutex_get</a> (<a class="el" href="group__apr__allocator.html#ga0">apr_allocator_t</a> *allocator)</td></tr> </table> <hr><h2>Define Documentation</h2> <a class="anchor" name="ga12" doxytag="apr_allocator.h::APR_ALLOCATOR_MAX_FREE_UNLIMITED"></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">#define APR_ALLOCATOR_MAX_FREE_UNLIMITED 0 </td> </tr> </table> </td> </tr> </table> <table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td> <p> Symbolic constants </td> </tr> </table> <a class="anchor" name="ga11" doxytag="apr_allocator.h::APR_MEMNODE_T_SIZE"></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">#define APR_MEMNODE_T_SIZE APR_ALIGN_DEFAULT(sizeof(<a class="el" href="structapr__memnode__t.html">apr_memnode_t</a>)) </td> </tr> </table> </td> </tr> </table> <table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td> <p> The base size of a memory node - aligned. </td> </tr> </table> <hr><h2>Typedef Documentation</h2> <a class="anchor" name="ga0" doxytag="apr_allocator.h::apr_allocator_t"></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 struct <a class="el" href="group__apr__allocator.html#ga0">apr_allocator_t</a> <a class="el" href="group__apr__allocator.html#ga0">apr_allocator_t</a> </td> </tr> </table> </td> </tr> </table> <table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td> <p> the allocator structure </td> </tr> </table> <a class="anchor" name="ga1" doxytag="apr_allocator.h::apr_memnode_t"></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 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> </td> </tr> </table> <table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td> <p> the structure which holds information about the allocation </td> </tr> </table> <hr><h2>Function Documentation</h2> <a class="anchor" name="ga4" doxytag="apr_allocator.h::apr_allocator_alloc"></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="structapr__memnode__t.html">apr_memnode_t</a>* apr_allocator_alloc </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group__apr__allocator.html#ga0">apr_allocator_t</a> * </td> <td class="mdname" nowrap> <em>allocator</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>apr_size_t </td> <td class="mdname" nowrap> <em>size</em></td> </tr> <tr> <td class="md"></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> 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> </td> </tr> </table> <a class="anchor" name="ga2" doxytag="apr_allocator.h::apr_allocator_create"></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="group__apr__errno.html#ga0">apr_status_t</a> apr_allocator_create </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group__apr__allocator.html#ga0">apr_allocator_t</a> ** </td> <td class="mdname1" valign="top" nowrap> <em>allocator</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> 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> </td> </tr> </table> <a class="anchor" name="ga3" doxytag="apr_allocator.h::apr_allocator_destroy"></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 apr_allocator_destroy </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group__apr__allocator.html#ga0">apr_allocator_t</a> * </td> <td class="mdname1" valign="top" nowrap> <em>allocator</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> 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> </td> </tr> </table> <a class="anchor" name="ga5" doxytag="apr_allocator.h::apr_allocator_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 apr_allocator_free </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group__apr__allocator.html#ga0">apr_allocator_t</a> * </td> <td class="mdname" nowrap> <em>allocator</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap><a class="el" href="structapr__memnode__t.html">apr_memnode_t</a> * </td> <td class="mdname" nowrap> <em>memnode</em></td> </tr> <tr> <td class="md"></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> 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> </td> </tr> </table> <a class="anchor" name="ga8" doxytag="apr_allocator.h::apr_allocator_max_free_set"></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 apr_allocator_max_free_set </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group__apr__allocator.html#ga0">apr_allocator_t</a> * </td> <td class="mdname" nowrap> <em>allocator</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>apr_size_t </td> <td class="mdname" nowrap> <em>size</em></td> </tr> <tr> <td class="md"></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> 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> </td> </tr> </table> <a class="anchor" name="ga10" doxytag="apr_allocator.h::apr_allocator_mutex_get"></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="group__apr__thread__mutex.html#ga0">apr_thread_mutex_t</a>* apr_allocator_mutex_get </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group__apr__allocator.html#ga0">apr_allocator_t</a> * </td> <td class="mdname1" valign="top" nowrap> <em>allocator</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> 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> </td> </tr> </table> <a class="anchor" name="ga9" doxytag="apr_allocator.h::apr_allocator_mutex_set"></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 apr_allocator_mutex_set </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group__apr__allocator.html#ga0">apr_allocator_t</a> * </td> <td class="mdname" nowrap> <em>allocator</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap><a class="el" href="group__apr__thread__mutex.html#ga0">apr_thread_mutex_t</a> * </td> <td class="mdname" nowrap> <em>mutex</em></td> </tr> <tr> <td class="md"></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> 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> </td> </tr> </table> <a class="anchor" name="ga7" doxytag="apr_allocator.h::apr_allocator_owner_get"></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="group__apr__pools.html#ga0">apr_pool_t</a>* apr_allocator_owner_get </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group__apr__allocator.html#ga0">apr_allocator_t</a> * </td> <td class="mdname1" valign="top" nowrap> <em>allocator</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> 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> </td> </tr> </table> <a class="anchor" name="ga6" doxytag="apr_allocator.h::apr_allocator_owner_set"></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 apr_allocator_owner_set </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group__apr__allocator.html#ga0">apr_allocator_t</a> * </td> <td class="mdname" nowrap> <em>allocator</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap><a class="el" href="group__apr__pools.html#ga0">apr_pool_t</a> * </td> <td class="mdname" nowrap> <em>pool</em></td> </tr> <tr> <td class="md"></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> 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> </td> </tr> </table> <hr size="1"><address style="align: right;"><small>Generated on Sun Mar 20 19:52:27 2005 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.3.9.1 </small></address> </body> </html>