Sophie

Sophie

distrib > Mandriva > 2007.0 > x86_64 > media > main-release > by-pkgid > 926d2d1e3111287cee1b0a4fad4fb4f6 > files > 186

lib64dbus-1_3-devel-0.92-6mdv2007.0.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>memory pools</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.15 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; <a class="qindex" href="annotated.html">Data Structures</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Data Fields</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; </center>
<hr><h1>memory pools<br>
<small>
[<a class="el" href="group__DBusInternals.html">D-BUS internal implementation details</a>]</small>
</h1>DBusMemPool object. 
<a href="#_details">More...</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
<tr><td nowrap align=right valign=top>typedef DBusMemPool&nbsp;</td><td valign=bottom><a class="el" href="group__DBusMemPool.html#a4">DBusMemPool</a></td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Opaque object representing a memory pool.</em> <a href="#a4">More...</a><em></em></font><br><br></td></tr>
<tr><td colspan=2><br><h2>Functions</h2></td></tr>
<tr><td nowrap align=right valign=top>DBusMemPool *&nbsp;</td><td valign=bottom><a class="el" href="group__DBusMemPool.html#a0">_dbus_mem_pool_new</a> (int <a class="el" href="structDBusMemPool.html#m0">element_size</a>, <a class="el" href="group__DBusTypes.html#a2">dbus_bool_t</a> <a class="el" href="structDBusMemPool.html#m2">zero_elements</a>)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Creates a new memory pool, or returns <a class="el" href="group__DBusMacros.html#a4">NULL</a> on failure.</em> <a href="#a0">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="group__DBusMemPool.html#a1">_dbus_mem_pool_free</a> (DBusMemPool *pool)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Frees a memory pool (and all elements allocated from it).</em> <a href="#a1">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void *&nbsp;</td><td valign=bottom><a class="el" href="group__DBusMemPool.html#a2">_dbus_mem_pool_alloc</a> (DBusMemPool *pool)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Allocates an object from the memory pool.</em> <a href="#a2">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top><a class="el" href="group__DBusTypes.html#a2">dbus_bool_t</a>&nbsp;</td><td valign=bottom><a class="el" href="group__DBusMemPool.html#a3">_dbus_mem_pool_dealloc</a> (DBusMemPool *pool, void *element)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Deallocates an object previously created with <a class="el" href="group__DBusMemPool.html#a2">_dbus_mem_pool_alloc</a>().</em> <a href="#a3">More...</a><em></em></font><br><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
DBusMemPool object.
<p>

<p>
 Types and functions related to DBusMemPool. A memory pool is used to decrease memory fragmentation/overhead and increase speed for blocks of small uniformly-sized objects. The main point is to avoid the overhead of a malloc block for each small object, speed is secondary. <hr><h2>Typedef Documentation</h2>
<a name="a4" doxytag="dbus-mempool.h::DBusMemPool"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DBusMemPool
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Opaque object representing a memory pool.
<p>
Memory pools allow avoiding per-malloc-block memory overhead when allocating a lot of small objects that are all the same size. They are slightly faster than calling malloc() also. 
<p>
Definition at line <a class="el" href="dbus-mempool_8h-source.html#l00033">33</a> of file <a class="el" href="dbus-mempool_8h-source.html">dbus-mempool.h</a>.    </td>
  </tr>
</table>
<hr><h2>Function Documentation</h2>
<a name="a2" doxytag="dbus-mempool.c::_dbus_mem_pool_alloc"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void* _dbus_mem_pool_alloc </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="structDBusMemPool.html">DBusMemPool</a> *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>pool</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Allocates an object from the memory pool.
<p>
The object must be freed with <a class="el" href="group__DBusMemPool.html#a3">_dbus_mem_pool_dealloc</a>().<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>pool</em>&nbsp;</td><td>
the memory pool </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
the allocated object or <a class="el" href="group__DBusMacros.html#a4">NULL</a> if no memory. </dl>
<p>
Definition at line <a class="el" href="dbus-mempool_8c-source.html#l00208">208</a> of file <a class="el" href="dbus-mempool_8c-source.html">dbus-mempool.c</a>.
<p>
References <a class="el" href="dbus-mempool_8c-source.html#l00104">allocated_elements</a>, <a class="el" href="dbus-mempool_8c-source.html#l00099">block_size</a>, <a class="el" href="dbus-mempool_8c-source.html#l00103">blocks</a>, <a class="el" href="dbus-mempool_8c-source.html#l00098">element_size</a>, <a class="el" href="dbus-mempool_8c-source.html#l00090">DBusMemBlock::elements</a>, <a class="el" href="dbus-mempool_8c-source.html#l00102">free_elements</a>, <a class="el" href="dbus-mempool_8c-source.html#l00082">DBusMemBlock::next</a>, <a class="el" href="dbus-mempool_8c-source.html#l00061">DBusFreedElement::next</a>, <a class="el" href="dbus-mempool_8c-source.html#l00088">DBusMemBlock::used_so_far</a>, and <a class="el" href="dbus-mempool_8c-source.html#l00100">zero_elements</a>.    </td>
  </tr>
</table>
<a name="a3" doxytag="dbus-mempool.c::_dbus_mem_pool_dealloc"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="group__DBusTypes.html#a2">dbus_bool_t</a> _dbus_mem_pool_dealloc </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="structDBusMemPool.html">DBusMemPool</a> *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>pool</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>void *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>element</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Deallocates an object previously created with <a class="el" href="group__DBusMemPool.html#a2">_dbus_mem_pool_alloc</a>().
<p>
The previous object must have come from this same pool. <dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>pool</em>&nbsp;</td><td>
the memory pool </td></tr>
<tr><td valign=top><em>element</em>&nbsp;</td><td>
the element earlier allocated. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
<a class="el" href="group__DBusMacros.html#a2">TRUE</a> if there are no remaining allocated elements </dl>
<p>
Definition at line <a class="el" href="dbus-mempool_8c-source.html#l00336">336</a> of file <a class="el" href="dbus-mempool_8c-source.html">dbus-mempool.c</a>.
<p>
References <a class="el" href="dbus-mempool_8c-source.html#l00104">allocated_elements</a>, <a class="el" href="dbus-mempool_8c-source.html#l00103">blocks</a>, <a class="el" href="dbus-mempool_8c-source.html#l00090">DBusMemBlock::elements</a>, <a class="el" href="dbus-mempool_8c-source.html#l00102">free_elements</a>, <a class="el" href="dbus-mempool_8c-source.html#l00082">DBusMemBlock::next</a>, and <a class="el" href="dbus-mempool_8c-source.html#l00061">DBusFreedElement::next</a>.    </td>
  </tr>
</table>
<a name="a1" doxytag="dbus-mempool.c::_dbus_mem_pool_free"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void _dbus_mem_pool_free </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="structDBusMemPool.html">DBusMemPool</a> *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>pool</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Frees a memory pool (and all elements allocated from it).
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>pool</em>&nbsp;</td><td>
the memory pool. </td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="dbus-mempool_8c-source.html#l00183">183</a> of file <a class="el" href="dbus-mempool_8c-source.html">dbus-mempool.c</a>.
<p>
References <a class="el" href="dbus-mempool_8c-source.html#l00103">blocks</a>, and <a class="el" href="dbus-mempool_8c-source.html#l00082">DBusMemBlock::next</a>.    </td>
  </tr>
</table>
<a name="a0" doxytag="dbus-mempool.c::_dbus_mem_pool_new"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="structDBusMemPool.html">DBusMemPool</a>* _dbus_mem_pool_new </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">int&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>element_size</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="group__DBusTypes.html#a2">dbus_bool_t</a>&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>zero_elements</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Creates a new memory pool, or returns <a class="el" href="group__DBusMacros.html#a4">NULL</a> on failure.
<p>
Objects in the pool must be at least sizeof(void*) bytes each, due to the way memory pools work. To avoid creating 64 bit problems, this means at least 8 bytes on all platforms, unless you are 4 bytes on 32-bit and 8 bytes on 64-bit.<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>element_size</em>&nbsp;</td><td>
size of an element allocated from the pool. </td></tr>
<tr><td valign=top><em>zero_elements</em>&nbsp;</td><td>
whether to zero-initialize elements </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
the new pool or <a class="el" href="group__DBusMacros.html#a4">NULL</a> </dl>
<p>
Definition at line <a class="el" href="dbus-mempool_8c-source.html#l00136">136</a> of file <a class="el" href="dbus-mempool_8c-source.html">dbus-mempool.c</a>.
<p>
References <a class="el" href="dbus-mempool_8c-source.html#l00104">allocated_elements</a>, <a class="el" href="dbus-mempool_8c-source.html#l00099">block_size</a>, <a class="el" href="dbus-mempool_8c-source.html#l00098">element_size</a>, and <a class="el" href="dbus-mempool_8c-source.html#l00100">zero_elements</a>.    </td>
  </tr>
</table>
<hr><address align="right"><small>Generated on Wed Jun 9 05:01:28 2004 for D-BUS by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.15 </small></address>
</body>
</html>