KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /usr/share/devhelp/books/dbus/api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/devhelp/books/dbus/api/group__DBusMemPool.html
<!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>D-Bus: memory pools</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&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
    <li><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul></div>
<h1>memory pools<br>
<small>
[<a class="el" href="group__DBusInternals.html">D-Bus secret internal implementation details</a>]</small>
</h1><a class="el" href="structDBusMemPool.html">DBusMemPool</a> object.  
<a href="#_details">More...</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></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="structDBusMemPool.html">DBusMemPool</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusMemPool.html#gadb50c95482bc5d2808e190c5618065c">DBusMemPool</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Opaque object representing a memory pool.  <a href="#gadb50c95482bc5d2808e190c5618065c"></a><br></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="structDBusMemPool.html">DBusMemPool</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusMemPool.html#gf1bae02bc5fcb879f77ff2c13ca03ac8">_dbus_mem_pool_new</a> (int element_size, <a class="el" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> zero_elements)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Creates a new memory pool, or returns <a class="el" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a> on failure.  <a href="#gf1bae02bc5fcb879f77ff2c13ca03ac8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusMemPool.html#g58e4f3def46410d5bb138a2b8f366b1a">_dbus_mem_pool_free</a> (<a class="el" href="structDBusMemPool.html">DBusMemPool</a> *pool)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Frees a memory pool (and all elements allocated from it).  <a href="#g58e4f3def46410d5bb138a2b8f366b1a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusMemPool.html#g0946d54f767b4f55238f5a39c8543df1">_dbus_mem_pool_alloc</a> (<a class="el" href="structDBusMemPool.html">DBusMemPool</a> *pool)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Allocates an object from the memory pool.  <a href="#g0946d54f767b4f55238f5a39c8543df1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusMemPool.html#g4e2feaefee7384ed940059e6c7b0a9d5">_dbus_mem_pool_dealloc</a> (<a class="el" href="structDBusMemPool.html">DBusMemPool</a> *pool, void *element)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Deallocates an object previously created with <a class="el" href="group__DBusMemPool.html#g0946d54f767b4f55238f5a39c8543df1">_dbus_mem_pool_alloc()</a>.  <a href="#g4e2feaefee7384ed940059e6c7b0a9d5"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<a class="el" href="structDBusMemPool.html">DBusMemPool</a> object. 
<p>
Types and functions related to <a class="el" href="structDBusMemPool.html">DBusMemPool</a>. 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 class="anchor" name="gadb50c95482bc5d2808e190c5618065c"></a><!-- doxytag: member="dbus-mempool.h::DBusMemPool" ref="gadb50c95482bc5d2808e190c5618065c" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structDBusMemPool.html">DBusMemPool</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<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>.
</div>
</div><p>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="g0946d54f767b4f55238f5a39c8543df1"></a><!-- doxytag: member="dbus-mempool.c::_dbus_mem_pool_alloc" ref="g0946d54f767b4f55238f5a39c8543df1" args="(DBusMemPool *pool)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void* _dbus_mem_pool_alloc           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structDBusMemPool.html">DBusMemPool</a> *&nbsp;</td>
          <td class="paramname"> <em>pool</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Allocates an object from the memory pool. 
<p>
The object must be freed with <a class="el" href="group__DBusMemPool.html#g4e2feaefee7384ed940059e6c7b0a9d5">_dbus_mem_pool_dealloc()</a>.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>pool</em>&nbsp;</td><td>the memory pool </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>the allocated object or <a class="el" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a> if no memory. </dd></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-internals_8h-source.html#l00109">_dbus_assert</a>, <a class="el" href="dbus-internals_8h-source.html#l00211">_DBUS_INT_MAX</a>, <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-memory_8c-source.html#l00440">dbus_malloc()</a>, <a class="el" href="dbus-memory_8c-source.html#l00493">dbus_malloc0()</a>, <a class="el" href="dbus-mempool_8c-source.html#l00068">ELEMENT_PADDING</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="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</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>.
</div>
</div><p>
<a class="anchor" name="g4e2feaefee7384ed940059e6c7b0a9d5"></a><!-- doxytag: member="dbus-mempool.c::_dbus_mem_pool_dealloc" ref="g4e2feaefee7384ed940059e6c7b0a9d5" args="(DBusMemPool *pool, void *element)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> _dbus_mem_pool_dealloc           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structDBusMemPool.html">DBusMemPool</a> *&nbsp;</td>
          <td class="paramname"> <em>pool</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&nbsp;</td>
          <td class="paramname"> <em>element</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Deallocates an object previously created with <a class="el" href="group__DBusMemPool.html#g0946d54f767b4f55238f5a39c8543df1">_dbus_mem_pool_alloc()</a>. 
<p>
The previous object must have come from this same pool. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>pool</em>&nbsp;</td><td>the memory pool </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>element</em>&nbsp;</td><td>the element earlier allocated. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><a class="el" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a> if there are no remaining allocated elements </dd></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-internals_8h-source.html#l00109">_dbus_assert</a>, <a class="el" href="dbus-internals_8h-source.html#l00121">_dbus_assert_not_reached</a>, <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-memory_8c-source.html#l00617">dbus_free()</a>, <a class="el" href="dbus-mempool_8c-source.html#l00090">DBusMemBlock::elements</a>, <a class="el" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</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>, and <a class="el" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>.
<p>
Referenced by <a class="el" href="dbus-hash_8c-source.html#l01643">_dbus_hash_table_free_preallocated_entry()</a>.
</div>
</div><p>
<a class="anchor" name="g58e4f3def46410d5bb138a2b8f366b1a"></a><!-- doxytag: member="dbus-mempool.c::_dbus_mem_pool_free" ref="g58e4f3def46410d5bb138a2b8f366b1a" args="(DBusMemPool *pool)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void _dbus_mem_pool_free           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structDBusMemPool.html">DBusMemPool</a> *&nbsp;</td>
          <td class="paramname"> <em>pool</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Frees a memory pool (and all elements allocated from it). 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><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>, <a class="el" href="dbus-memory_8c-source.html#l00617">dbus_free()</a>, <a class="el" href="dbus-mempool_8c-source.html#l00082">DBusMemBlock::next</a>, and <a class="el" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>.
<p>
Referenced by <a class="el" href="dbus-hash_8c-source.html#l00374">_dbus_hash_table_unref()</a>.
</div>
</div><p>
<a class="anchor" name="gf1bae02bc5fcb879f77ff2c13ca03ac8"></a><!-- doxytag: member="dbus-mempool.c::_dbus_mem_pool_new" ref="gf1bae02bc5fcb879f77ff2c13ca03ac8" args="(int element_size, dbus_bool_t zero_elements)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structDBusMemPool.html">DBusMemPool</a>* _dbus_mem_pool_new           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>element_size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>&nbsp;</td>
          <td class="paramname"> <em>zero_elements</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Creates a new memory pool, or returns <a class="el" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">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.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>element_size</em>&nbsp;</td><td>size of an element allocated from the pool. </td></tr>
    <tr><td valign="top"></td><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></dt><dd>the new pool or <a class="el" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a> </dd></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-internals_8h-source.html#l00109">_dbus_assert</a>, <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-memory_8h-source.html#l00047">dbus_new0</a>, <a class="el" href="dbus-mempool_8c-source.html#l00098">element_size</a>, <a class="el" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>, <a class="el" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, and <a class="el" href="dbus-mempool_8c-source.html#l00100">zero_elements</a>.
<p>
Referenced by <a class="el" href="dbus-hash_8c-source.html#l00292">_dbus_hash_table_new()</a>.
</div>
</div><p>
<hr size="1"><address style="align: right;"><small>Generated on Mon Dec 14 22:26:14 2009 for D-Bus by&nbsp;
<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>

Anon7 - 2021