Sun, 22 Dec 2024 22:10:04 +0100
don't trust that size_t always has word width
it should be the case on all platforms supported by UCX, but it's not strictly defined in POSIX that it must be the case
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.13"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>ucx: /home/mike/workspace/c/ucx/src/ucx/allocator.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="uaplogo.png"/></td> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">ucx </div> <div id="projectbrief">UAP Common Extensions</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.13 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); </script> <div id="main-nav"></div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_69f4ea29401808fe6229564976cde3ce.html">ucx</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#nested-classes">Data Structures</a> | <a href="#define-members">Macros</a> | <a href="#typedef-members">Typedefs</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">allocator.h File Reference</div> </div> </div><!--header--> <div class="contents"> <p>Allocator for custom memory management. <a href="#details">More...</a></p> <div class="textblock"><code>#include "<a class="el" href="ucx_8h_source.html">ucx.h</a>"</code><br /> </div> <p><a href="allocator_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> Data Structures</h2></td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structUcxAllocator.html">UcxAllocator</a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">UCX allocator data structure containing memory management functions. <a href="structUcxAllocator.html#details">More...</a><br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a> Macros</h2></td></tr> <tr class="memitem:ae1bc218fea8a35f4a3706f0beefcfb19"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="allocator_8h.html#ae1bc218fea8a35f4a3706f0beefcfb19">almalloc</a>(allocator, n)   ((allocator)->malloc((allocator)->pool, n))</td></tr> <tr class="memdesc:ae1bc218fea8a35f4a3706f0beefcfb19"><td class="mdescLeft"> </td><td class="mdescRight">Shorthand for calling an allocators malloc function. <a href="#ae1bc218fea8a35f4a3706f0beefcfb19">More...</a><br /></td></tr> <tr class="separator:ae1bc218fea8a35f4a3706f0beefcfb19"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a8d71470816f88f78cb9a9686c57e1b10"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="allocator_8h.html#a8d71470816f88f78cb9a9686c57e1b10">alcalloc</a>(allocator, n, size)   ((allocator)->calloc((allocator)->pool, n, size))</td></tr> <tr class="memdesc:a8d71470816f88f78cb9a9686c57e1b10"><td class="mdescLeft"> </td><td class="mdescRight">Shorthand for calling an allocators calloc function. <a href="#a8d71470816f88f78cb9a9686c57e1b10">More...</a><br /></td></tr> <tr class="separator:a8d71470816f88f78cb9a9686c57e1b10"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a029ee5c9bcbb3f873571553f788c5820"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="allocator_8h.html#a029ee5c9bcbb3f873571553f788c5820">alrealloc</a>(allocator, ptr, n)   ((allocator)->realloc((allocator)->pool, ptr, n))</td></tr> <tr class="memdesc:a029ee5c9bcbb3f873571553f788c5820"><td class="mdescLeft"> </td><td class="mdescRight">Shorthand for calling an allocators realloc function. <a href="#a029ee5c9bcbb3f873571553f788c5820">More...</a><br /></td></tr> <tr class="separator:a029ee5c9bcbb3f873571553f788c5820"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:acd775785b54e97dc2b33a432c12c8fb2"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="allocator_8h.html#acd775785b54e97dc2b33a432c12c8fb2">alfree</a>(allocator, ptr)   ((allocator)->free((allocator)->pool, ptr))</td></tr> <tr class="memdesc:acd775785b54e97dc2b33a432c12c8fb2"><td class="mdescLeft"> </td><td class="mdescRight">Shorthand for calling an allocators free function. <a href="#acd775785b54e97dc2b33a432c12c8fb2">More...</a><br /></td></tr> <tr class="separator:acd775785b54e97dc2b33a432c12c8fb2"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a1283a8f875f90a7af3aba5e031fc2e3f"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="allocator_8h.html#a1283a8f875f90a7af3aba5e031fc2e3f">UCX_ALLOCATOR_DEFAULT</a></td></tr> <tr class="memdesc:a1283a8f875f90a7af3aba5e031fc2e3f"><td class="mdescLeft"> </td><td class="mdescRight">Convenient macro for a default allocator <code>struct</code> definition. <a href="#a1283a8f875f90a7af3aba5e031fc2e3f">More...</a><br /></td></tr> <tr class="separator:a1283a8f875f90a7af3aba5e031fc2e3f"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> Typedefs</h2></td></tr> <tr class="memitem:a29f0f6a23a70db3b60635cd6dc384473"><td class="memItemLeft" align="right" valign="top">typedef void *(* </td><td class="memItemRight" valign="bottom"><a class="el" href="allocator_8h.html#a29f0f6a23a70db3b60635cd6dc384473">ucx_allocator_malloc</a>) (void *pool, size_t n)</td></tr> <tr class="memdesc:a29f0f6a23a70db3b60635cd6dc384473"><td class="mdescLeft"> </td><td class="mdescRight">A function pointer to the allocators <code>malloc()</code> function. <a href="#a29f0f6a23a70db3b60635cd6dc384473">More...</a><br /></td></tr> <tr class="separator:a29f0f6a23a70db3b60635cd6dc384473"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a2c0aba4221c1ac6801f03ed799f15b12"><td class="memItemLeft" align="right" valign="top">typedef void *(* </td><td class="memItemRight" valign="bottom"><a class="el" href="allocator_8h.html#a2c0aba4221c1ac6801f03ed799f15b12">ucx_allocator_calloc</a>) (void *pool, size_t n, size_t size)</td></tr> <tr class="memdesc:a2c0aba4221c1ac6801f03ed799f15b12"><td class="mdescLeft"> </td><td class="mdescRight">A function pointer to the allocators <code>calloc()</code> function. <a href="#a2c0aba4221c1ac6801f03ed799f15b12">More...</a><br /></td></tr> <tr class="separator:a2c0aba4221c1ac6801f03ed799f15b12"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a6d7cf038a806e327c5da37321d04e426"><td class="memItemLeft" align="right" valign="top">typedef void *(* </td><td class="memItemRight" valign="bottom"><a class="el" href="allocator_8h.html#a6d7cf038a806e327c5da37321d04e426">ucx_allocator_realloc</a>) (void *pool, void *data, size_t n)</td></tr> <tr class="memdesc:a6d7cf038a806e327c5da37321d04e426"><td class="mdescLeft"> </td><td class="mdescRight">A function pointer to the allocators <code>realloc()</code> function. <a href="#a6d7cf038a806e327c5da37321d04e426">More...</a><br /></td></tr> <tr class="separator:a6d7cf038a806e327c5da37321d04e426"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:aaf2387ddaddd8ab4b267e6b00e5d6f7e"><td class="memItemLeft" align="right" valign="top">typedef void(* </td><td class="memItemRight" valign="bottom"><a class="el" href="allocator_8h.html#aaf2387ddaddd8ab4b267e6b00e5d6f7e">ucx_allocator_free</a>) (void *pool, void *data)</td></tr> <tr class="memdesc:aaf2387ddaddd8ab4b267e6b00e5d6f7e"><td class="mdescLeft"> </td><td class="mdescRight">A function pointer to the allocators <code>free()</code> function. <a href="#aaf2387ddaddd8ab4b267e6b00e5d6f7e">More...</a><br /></td></tr> <tr class="separator:aaf2387ddaddd8ab4b267e6b00e5d6f7e"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:a98d2f1b341118b7a0e341fda5d8b2ebf"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structUcxAllocator.html">UcxAllocator</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="allocator_8h.html#a98d2f1b341118b7a0e341fda5d8b2ebf">ucx_default_allocator</a> ()</td></tr> <tr class="memdesc:a98d2f1b341118b7a0e341fda5d8b2ebf"><td class="mdescLeft"> </td><td class="mdescRight">Returns a pointer to the default allocator. <a href="#a98d2f1b341118b7a0e341fda5d8b2ebf">More...</a><br /></td></tr> <tr class="separator:a98d2f1b341118b7a0e341fda5d8b2ebf"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a96403ebf3d2312d95f2fe7627a1cdbc0"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="allocator_8h.html#a96403ebf3d2312d95f2fe7627a1cdbc0">ucx_default_malloc</a> (void *ignore, size_t n)</td></tr> <tr class="memdesc:a96403ebf3d2312d95f2fe7627a1cdbc0"><td class="mdescLeft"> </td><td class="mdescRight">A wrapper for the standard libc <code>malloc()</code> function. <a href="#a96403ebf3d2312d95f2fe7627a1cdbc0">More...</a><br /></td></tr> <tr class="separator:a96403ebf3d2312d95f2fe7627a1cdbc0"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a3a0bfdd13d887012309c459b339f338f"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="allocator_8h.html#a3a0bfdd13d887012309c459b339f338f">ucx_default_calloc</a> (void *ignore, size_t n, size_t size)</td></tr> <tr class="memdesc:a3a0bfdd13d887012309c459b339f338f"><td class="mdescLeft"> </td><td class="mdescRight">A wrapper for the standard libc <code>calloc()</code> function. <a href="#a3a0bfdd13d887012309c459b339f338f">More...</a><br /></td></tr> <tr class="separator:a3a0bfdd13d887012309c459b339f338f"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a47cfc8af626a86fcb93a2b14b90498ed"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="allocator_8h.html#a47cfc8af626a86fcb93a2b14b90498ed">ucx_default_realloc</a> (void *ignore, void *data, size_t n)</td></tr> <tr class="memdesc:a47cfc8af626a86fcb93a2b14b90498ed"><td class="mdescLeft"> </td><td class="mdescRight">A wrapper for the standard libc <code>realloc()</code> function. <a href="#a47cfc8af626a86fcb93a2b14b90498ed">More...</a><br /></td></tr> <tr class="separator:a47cfc8af626a86fcb93a2b14b90498ed"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a646d83aaaadfe33ae414c0fad8bfc52a"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="allocator_8h.html#a646d83aaaadfe33ae414c0fad8bfc52a">ucx_default_free</a> (void *ignore, void *data)</td></tr> <tr class="memdesc:a646d83aaaadfe33ae414c0fad8bfc52a"><td class="mdescLeft"> </td><td class="mdescRight">A wrapper for the standard libc <code>free()</code> function. <a href="#a646d83aaaadfe33ae414c0fad8bfc52a">More...</a><br /></td></tr> <tr class="separator:a646d83aaaadfe33ae414c0fad8bfc52a"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>Allocator for custom memory management. </p> <p>A UCX allocator consists of a pointer to the memory area / pool and four function pointers to memory management functions operating on this memory area / pool. These functions shall behave equivalent to the standard libc functions <code>malloc(), calloc(), realloc()</code> and <code>free()</code>.</p> <p>The signature of the memory management functions is based on the signature of the respective libc function but each of them takes the pointer to the memory area / pool as first argument.</p> <p>As the pointer to the memory area / pool can be arbitrarily chosen, any data can be provided to the memory management functions. A <a class="el" href="structUcxMempool.html" title="UCX mempool structure. ">UcxMempool</a> is just one example.</p> <dl class="section see"><dt>See also</dt><dd><a class="el" href="mempool_8h.html" title="Memory pool implementation. ">mempool.h</a> </dd> <dd> <a class="el" href="structUcxMap.html" title="Structure for the UCX map. ">UcxMap</a></dd></dl> <dl class="section author"><dt>Author</dt><dd>Mike Becker </dd> <dd> Olaf Wintermann </dd></dl> </div><h2 class="groupheader">Macro Definition Documentation</h2> <a id="a8d71470816f88f78cb9a9686c57e1b10"></a> <h2 class="memtitle"><span class="permalink"><a href="#a8d71470816f88f78cb9a9686c57e1b10">◆ </a></span>alcalloc</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define alcalloc</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname">allocator, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">n, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">size </td> </tr> <tr> <td></td> <td>)</td> <td></td><td>   ((allocator)->calloc((allocator)->pool, n, size))</td> </tr> </table> </div><div class="memdoc"> <p>Shorthand for calling an allocators calloc function. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">allocator</td><td>the allocator to use </td></tr> <tr><td class="paramname">n</td><td>the count of elements the space should be allocated for </td></tr> <tr><td class="paramname">size</td><td>the size of each element </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>a pointer to the allocated memory area </dd></dl> </div> </div> <a id="acd775785b54e97dc2b33a432c12c8fb2"></a> <h2 class="memtitle"><span class="permalink"><a href="#acd775785b54e97dc2b33a432c12c8fb2">◆ </a></span>alfree</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define alfree</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname">allocator, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">ptr </td> </tr> <tr> <td></td> <td>)</td> <td></td><td>   ((allocator)->free((allocator)->pool, ptr))</td> </tr> </table> </div><div class="memdoc"> <p>Shorthand for calling an allocators free function. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">allocator</td><td>the allocator to use </td></tr> <tr><td class="paramname">ptr</td><td>the pointer to the memory area that shall be freed </td></tr> </table> </dd> </dl> </div> </div> <a id="ae1bc218fea8a35f4a3706f0beefcfb19"></a> <h2 class="memtitle"><span class="permalink"><a href="#ae1bc218fea8a35f4a3706f0beefcfb19">◆ </a></span>almalloc</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define almalloc</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname">allocator, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">n </td> </tr> <tr> <td></td> <td>)</td> <td></td><td>   ((allocator)->malloc((allocator)->pool, n))</td> </tr> </table> </div><div class="memdoc"> <p>Shorthand for calling an allocators malloc function. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">allocator</td><td>the allocator to use </td></tr> <tr><td class="paramname">n</td><td>size of space to allocate </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>a pointer to the allocated memory area </dd></dl> </div> </div> <a id="a029ee5c9bcbb3f873571553f788c5820"></a> <h2 class="memtitle"><span class="permalink"><a href="#a029ee5c9bcbb3f873571553f788c5820">◆ </a></span>alrealloc</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define alrealloc</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname">allocator, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">ptr, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">n </td> </tr> <tr> <td></td> <td>)</td> <td></td><td>   ((allocator)->realloc((allocator)->pool, ptr, n))</td> </tr> </table> </div><div class="memdoc"> <p>Shorthand for calling an allocators realloc function. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">allocator</td><td>the allocator to use </td></tr> <tr><td class="paramname">ptr</td><td>the pointer to the memory area that shall be reallocated </td></tr> <tr><td class="paramname">n</td><td>the new size of the allocated memory area </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>a pointer to the reallocated memory area </dd></dl> </div> </div> <a id="a1283a8f875f90a7af3aba5e031fc2e3f"></a> <h2 class="memtitle"><span class="permalink"><a href="#a1283a8f875f90a7af3aba5e031fc2e3f">◆ </a></span>UCX_ALLOCATOR_DEFAULT</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define UCX_ALLOCATOR_DEFAULT</td> </tr> </table> </div><div class="memdoc"> <b>Value:</b><div class="fragment"><div class="line">{NULL, \</div><div class="line"> ucx_default_malloc, <a class="code" href="allocator_8h.html#a3a0bfdd13d887012309c459b339f338f">ucx_default_calloc</a>, <a class="code" href="allocator_8h.html#a47cfc8af626a86fcb93a2b14b90498ed">ucx_default_realloc</a>, \</div><div class="line"> ucx_default_free }</div><div class="ttc" id="allocator_8h_html_a3a0bfdd13d887012309c459b339f338f"><div class="ttname"><a href="allocator_8h.html#a3a0bfdd13d887012309c459b339f338f">ucx_default_calloc</a></div><div class="ttdeci">void * ucx_default_calloc(void *ignore, size_t n, size_t size)</div><div class="ttdoc">A wrapper for the standard libc calloc() function. </div><div class="ttdef"><b>Definition:</b> allocator.c:50</div></div> <div class="ttc" id="allocator_8h_html_a47cfc8af626a86fcb93a2b14b90498ed"><div class="ttname"><a href="allocator_8h.html#a47cfc8af626a86fcb93a2b14b90498ed">ucx_default_realloc</a></div><div class="ttdeci">void * ucx_default_realloc(void *ignore, void *data, size_t n)</div><div class="ttdoc">A wrapper for the standard libc realloc() function. </div><div class="ttdef"><b>Definition:</b> allocator.c:54</div></div> </div><!-- fragment --> <p>Convenient macro for a default allocator <code>struct</code> definition. </p> </div> </div> <h2 class="groupheader">Typedef Documentation</h2> <a id="a2c0aba4221c1ac6801f03ed799f15b12"></a> <h2 class="memtitle"><span class="permalink"><a href="#a2c0aba4221c1ac6801f03ed799f15b12">◆ </a></span>ucx_allocator_calloc</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef void*(* ucx_allocator_calloc) (void *pool, size_t n, size_t size)</td> </tr> </table> </div><div class="memdoc"> <p>A function pointer to the allocators <code>calloc()</code> function. </p> <dl class="section see"><dt>See also</dt><dd><a class="el" href="structUcxAllocator.html" title="UCX allocator data structure containing memory management functions. ">UcxAllocator</a> </dd></dl> </div> </div> <a id="aaf2387ddaddd8ab4b267e6b00e5d6f7e"></a> <h2 class="memtitle"><span class="permalink"><a href="#aaf2387ddaddd8ab4b267e6b00e5d6f7e">◆ </a></span>ucx_allocator_free</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef void(* ucx_allocator_free) (void *pool, void *data)</td> </tr> </table> </div><div class="memdoc"> <p>A function pointer to the allocators <code>free()</code> function. </p> <dl class="section see"><dt>See also</dt><dd><a class="el" href="structUcxAllocator.html" title="UCX allocator data structure containing memory management functions. ">UcxAllocator</a> </dd></dl> </div> </div> <a id="a29f0f6a23a70db3b60635cd6dc384473"></a> <h2 class="memtitle"><span class="permalink"><a href="#a29f0f6a23a70db3b60635cd6dc384473">◆ </a></span>ucx_allocator_malloc</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef void*(* ucx_allocator_malloc) (void *pool, size_t n)</td> </tr> </table> </div><div class="memdoc"> <p>A function pointer to the allocators <code>malloc()</code> function. </p> <dl class="section see"><dt>See also</dt><dd><a class="el" href="structUcxAllocator.html" title="UCX allocator data structure containing memory management functions. ">UcxAllocator</a> </dd></dl> </div> </div> <a id="a6d7cf038a806e327c5da37321d04e426"></a> <h2 class="memtitle"><span class="permalink"><a href="#a6d7cf038a806e327c5da37321d04e426">◆ </a></span>ucx_allocator_realloc</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef void*(* ucx_allocator_realloc) (void *pool, void *data, size_t n)</td> </tr> </table> </div><div class="memdoc"> <p>A function pointer to the allocators <code>realloc()</code> function. </p> <dl class="section see"><dt>See also</dt><dd><a class="el" href="structUcxAllocator.html" title="UCX allocator data structure containing memory management functions. ">UcxAllocator</a> </dd></dl> </div> </div> <h2 class="groupheader">Function Documentation</h2> <a id="a98d2f1b341118b7a0e341fda5d8b2ebf"></a> <h2 class="memtitle"><span class="permalink"><a href="#a98d2f1b341118b7a0e341fda5d8b2ebf">◆ </a></span>ucx_default_allocator()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="structUcxAllocator.html">UcxAllocator</a>* ucx_default_allocator </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Returns a pointer to the default allocator. </p> <p>The default allocator contains wrappers to the standard libc memory management functions. Use this function to get a pointer to a globally available allocator. You may also define an own <a class="el" href="structUcxAllocator.html" title="UCX allocator data structure containing memory management functions. ">UcxAllocator</a> by assigning <a class="el" href="allocator_8h.html#a1283a8f875f90a7af3aba5e031fc2e3f" title="Convenient macro for a default allocator struct definition. ">UCX_ALLOCATOR_DEFAULT</a> to a variable and pass the address of this variable to any function that takes a <a class="el" href="structUcxAllocator.html" title="UCX allocator data structure containing memory management functions. ">UcxAllocator</a> as argument. Note that using this function is the recommended way of passing a default allocator, thus it never runs out of scope.</p> <dl class="section return"><dt>Returns</dt><dd>a pointer to the default allocator</dd></dl> <dl class="section see"><dt>See also</dt><dd><a class="el" href="allocator_8h.html#a1283a8f875f90a7af3aba5e031fc2e3f" title="Convenient macro for a default allocator struct definition. ">UCX_ALLOCATOR_DEFAULT</a> </dd></dl> </div> </div> <a id="a3a0bfdd13d887012309c459b339f338f"></a> <h2 class="memtitle"><span class="permalink"><a href="#a3a0bfdd13d887012309c459b339f338f">◆ </a></span>ucx_default_calloc()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void* ucx_default_calloc </td> <td>(</td> <td class="paramtype">void * </td> <td class="paramname"><em>ignore</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>n</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>size</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>A wrapper for the standard libc <code>calloc()</code> function. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">ignore</td><td>ignored (may be used by allocators for pooled memory) </td></tr> <tr><td class="paramname">n</td><td>argument passed to <code>calloc()</code> </td></tr> <tr><td class="paramname">size</td><td>argument passed to <code>calloc()</code> </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>return value of <code>calloc()</code> </dd></dl> </div> </div> <a id="a646d83aaaadfe33ae414c0fad8bfc52a"></a> <h2 class="memtitle"><span class="permalink"><a href="#a646d83aaaadfe33ae414c0fad8bfc52a">◆ </a></span>ucx_default_free()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ucx_default_free </td> <td>(</td> <td class="paramtype">void * </td> <td class="paramname"><em>ignore</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"><em>data</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>A wrapper for the standard libc <code>free()</code> function. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">ignore</td><td>ignored (may be used by allocators for pooled memory) </td></tr> <tr><td class="paramname">data</td><td>argument passed to <code>free()</code> </td></tr> </table> </dd> </dl> </div> </div> <a id="a96403ebf3d2312d95f2fe7627a1cdbc0"></a> <h2 class="memtitle"><span class="permalink"><a href="#a96403ebf3d2312d95f2fe7627a1cdbc0">◆ </a></span>ucx_default_malloc()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void* ucx_default_malloc </td> <td>(</td> <td class="paramtype">void * </td> <td class="paramname"><em>ignore</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>n</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>A wrapper for the standard libc <code>malloc()</code> function. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">ignore</td><td>ignored (may be used by allocators for pooled memory) </td></tr> <tr><td class="paramname">n</td><td>argument passed to <code>malloc()</code> </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>return value of <code>malloc()</code> </dd></dl> </div> </div> <a id="a47cfc8af626a86fcb93a2b14b90498ed"></a> <h2 class="memtitle"><span class="permalink"><a href="#a47cfc8af626a86fcb93a2b14b90498ed">◆ </a></span>ucx_default_realloc()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void* ucx_default_realloc </td> <td>(</td> <td class="paramtype">void * </td> <td class="paramname"><em>ignore</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"><em>data</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"><em>n</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>A wrapper for the standard libc <code>realloc()</code> function. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">ignore</td><td>ignored (may be used by allocators for pooled memory) </td></tr> <tr><td class="paramname">data</td><td>argumend passed to <code>realloc()</code> </td></tr> <tr><td class="paramname">n</td><td>argument passed to <code>realloc()</code> </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>return value of <code>realloc()</code> </dd></dl> </div> </div> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Thu Dec 19 2019 19:58:24 for ucx by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.13 </small></address> </body> </html>