alloc_8h_source.html 17 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6. <meta name="generator" content="Doxygen 1.8.13"/>
  7. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  8. <title>GRPC C++: include/grpc/support/alloc.h Source File</title>
  9. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  10. <script type="text/javascript" src="jquery.js"></script>
  11. <script type="text/javascript" src="dynsections.js"></script>
  12. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  13. <script type="text/javascript" src="search/searchdata.js"></script>
  14. <script type="text/javascript" src="search/search.js"></script>
  15. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  16. <script type="text/javascript"> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-60127042-1', 'auto'); ga('send', 'pageview'); </script></head>
  17. <body>
  18. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  19. <div id="titlearea">
  20. <table cellspacing="0" cellpadding="0">
  21. <tbody>
  22. <tr style="height: 56px;">
  23. <td id="projectalign" style="padding-left: 0.5em;">
  24. <div id="projectname">GRPC C++
  25. &#160;<span id="projectnumber">1.13.0-dev</span>
  26. </div>
  27. </td>
  28. </tr>
  29. </tbody>
  30. </table>
  31. </div>
  32. <!-- end header part -->
  33. <!-- Generated by Doxygen 1.8.13 -->
  34. <script type="text/javascript">
  35. var searchBox = new SearchBox("searchBox", "search",false,'Search');
  36. </script>
  37. <script type="text/javascript" src="menudata.js"></script>
  38. <script type="text/javascript" src="menu.js"></script>
  39. <script type="text/javascript">
  40. $(function() {
  41. initMenu('',true,false,'search.php','Search');
  42. $(document).ready(function() { init_search(); });
  43. });
  44. </script>
  45. <div id="main-nav"></div>
  46. <!-- window showing the filter options -->
  47. <div id="MSearchSelectWindow"
  48. onmouseover="return searchBox.OnSearchSelectShow()"
  49. onmouseout="return searchBox.OnSearchSelectHide()"
  50. onkeydown="return searchBox.OnSearchSelectKey(event)">
  51. </div>
  52. <!-- iframe showing the search results (closed by default) -->
  53. <div id="MSearchResultsWindow">
  54. <iframe src="javascript:void(0)" frameborder="0"
  55. name="MSearchResults" id="MSearchResults">
  56. </iframe>
  57. </div>
  58. <div id="nav-path" class="navpath">
  59. <ul>
  60. <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_9d7a14d6d9adcbe4c35dbdb88d867e2e.html">grpc</a></li><li class="navelem"><a class="el" href="dir_cad3142e04109052413f2d2a2d1813b0.html">support</a></li> </ul>
  61. </div>
  62. </div><!-- top -->
  63. <div class="header">
  64. <div class="headertitle">
  65. <div class="title">alloc.h</div> </div>
  66. </div><!--header-->
  67. <div class="contents">
  68. <a href="alloc_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment"> * Copyright 2015 gRPC authors.</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment"> * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment"> * you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment"> * You may obtain a copy of the License at</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment"> * Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment"> * See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="comment"> * limitations under the License.</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="preprocessor">#ifndef GRPC_SUPPORT_ALLOC_H</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="preprocessor">#define GRPC_SUPPORT_ALLOC_H</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="support_2port__platform_8h.html">grpc/support/port_platform.h</a>&gt;</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="preprocessor">#include &lt;stddef.h&gt;</span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;<span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;</div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="structgpr__allocation__functions.html"> 30</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structgpr__allocation__functions.html">gpr_allocation_functions</a> {</div><div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="structgpr__allocation__functions.html#ad305eae61dce43f120ea64da1fe889f1"> 31</a></span>&#160; <span class="keywordtype">void</span>* (*malloc_fn)(<span class="keywordtype">size_t</span> size);</div><div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="structgpr__allocation__functions.html#ac3b36e6fa09be3fec1bfc7fcc956dbfb"> 32</a></span>&#160; <span class="keywordtype">void</span>* (*zalloc_fn)(<span class="keywordtype">size_t</span> size); </div><div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="structgpr__allocation__functions.html#a6e045f05fd723164fb8d6d6eeeed305e"> 33</a></span>&#160; <span class="keywordtype">void</span>* (*realloc_fn)(<span class="keywordtype">void</span>* ptr, <span class="keywordtype">size_t</span> size);</div><div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="structgpr__allocation__functions.html#a1cebaedc2a76e00f773254bd16ab5f9a"> 34</a></span>&#160; void (*<a class="code" href="structgpr__allocation__functions.html#a1cebaedc2a76e00f773254bd16ab5f9a">free_fn</a>)(<span class="keywordtype">void</span>* ptr);</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;} <a class="code" href="alloc_8h.html#a54bbd527f303da4b618adb37ae44efd7">gpr_allocation_functions</a>;</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160;<a class="code" href="impl_2codegen_2port__platform_8h.html#af89d3610372fc35178e83e06916aa808">GPRAPI</a> <span class="keywordtype">void</span>* <a class="code" href="alloc_8h.html#aa15f6aa58f356420b0d955fc6e506a60">gpr_malloc</a>(<span class="keywordtype">size_t</span> size);</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160;<a class="code" href="impl_2codegen_2port__platform_8h.html#af89d3610372fc35178e83e06916aa808">GPRAPI</a> <span class="keywordtype">void</span>* <a class="code" href="alloc_8h.html#ad9a7a782f4f00cad27d64d27ebbd1a72">gpr_zalloc</a>(<span class="keywordtype">size_t</span> size);</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160;<a class="code" href="impl_2codegen_2port__platform_8h.html#af89d3610372fc35178e83e06916aa808">GPRAPI</a> <span class="keywordtype">void</span> <a class="code" href="alloc_8h.html#a7f8641de6e80a37dd003d3100cc94bd7">gpr_free</a>(<span class="keywordtype">void</span>* ptr);</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160;<a class="code" href="impl_2codegen_2port__platform_8h.html#af89d3610372fc35178e83e06916aa808">GPRAPI</a> <span class="keywordtype">void</span>* <a class="code" href="alloc_8h.html#a4282437d10bb2b1a2c44d665a97984f4">gpr_realloc</a>(<span class="keywordtype">void</span>* p, <span class="keywordtype">size_t</span> size);</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<a class="code" href="impl_2codegen_2port__platform_8h.html#af89d3610372fc35178e83e06916aa808">GPRAPI</a> <span class="keywordtype">void</span>* <a class="code" href="alloc_8h.html#a29ae1ca65e84c7df8626d0a6de2a581a">gpr_malloc_aligned</a>(<span class="keywordtype">size_t</span> size, <span class="keywordtype">size_t</span> alignment);</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160;<a class="code" href="impl_2codegen_2port__platform_8h.html#af89d3610372fc35178e83e06916aa808">GPRAPI</a> <span class="keywordtype">void</span> <a class="code" href="alloc_8h.html#aafbdc542e56bcd24fcb80a9cd55afef1">gpr_free_aligned</a>(<span class="keywordtype">void</span>* ptr);</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160;<a class="code" href="impl_2codegen_2port__platform_8h.html#af89d3610372fc35178e83e06916aa808">GPRAPI</a> <span class="keywordtype">void</span> <a class="code" href="alloc_8h.html#a2a32fcafdda423e2a11b4130d55951b4">gpr_set_allocation_functions</a>(<a class="code" href="structgpr__allocation__functions.html">gpr_allocation_functions</a> functions);</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160;</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160;<a class="code" href="impl_2codegen_2port__platform_8h.html#af89d3610372fc35178e83e06916aa808">GPRAPI</a> <a class="code" href="structgpr__allocation__functions.html">gpr_allocation_functions</a> <a class="code" href="alloc_8h.html#aa96aa61deb3f72c6e5d8f57d08942602">gpr_get_allocation_functions</a>(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;}</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160;</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* GRPC_SUPPORT_ALLOC_H */</span><span class="preprocessor"></span></div><div class="ttc" id="alloc_8h_html_a54bbd527f303da4b618adb37ae44efd7"><div class="ttname"><a href="alloc_8h.html#a54bbd527f303da4b618adb37ae44efd7">gpr_allocation_functions</a></div><div class="ttdeci">struct gpr_allocation_functions gpr_allocation_functions</div></div>
  69. <div class="ttc" id="structgpr__allocation__functions_html"><div class="ttname"><a href="structgpr__allocation__functions.html">gpr_allocation_functions</a></div><div class="ttdef"><b>Definition:</b> alloc.h:30</div></div>
  70. <div class="ttc" id="impl_2codegen_2port__platform_8h_html_af89d3610372fc35178e83e06916aa808"><div class="ttname"><a href="impl_2codegen_2port__platform_8h.html#af89d3610372fc35178e83e06916aa808">GPRAPI</a></div><div class="ttdeci">#define GPRAPI</div><div class="ttdef"><b>Definition:</b> port_platform.h:466</div></div>
  71. <div class="ttc" id="alloc_8h_html_aafbdc542e56bcd24fcb80a9cd55afef1"><div class="ttname"><a href="alloc_8h.html#aafbdc542e56bcd24fcb80a9cd55afef1">gpr_free_aligned</a></div><div class="ttdeci">GPRAPI void gpr_free_aligned(void *ptr)</div><div class="ttdoc">free memory allocated by gpr_malloc_aligned </div></div>
  72. <div class="ttc" id="alloc_8h_html_a29ae1ca65e84c7df8626d0a6de2a581a"><div class="ttname"><a href="alloc_8h.html#a29ae1ca65e84c7df8626d0a6de2a581a">gpr_malloc_aligned</a></div><div class="ttdeci">GPRAPI void * gpr_malloc_aligned(size_t size, size_t alignment)</div><div class="ttdoc">aligned malloc, never returns NULL, will align to alignment, which must be a power of 2...</div></div>
  73. <div class="ttc" id="alloc_8h_html_a7f8641de6e80a37dd003d3100cc94bd7"><div class="ttname"><a href="alloc_8h.html#a7f8641de6e80a37dd003d3100cc94bd7">gpr_free</a></div><div class="ttdeci">GPRAPI void gpr_free(void *ptr)</div><div class="ttdoc">free </div></div>
  74. <div class="ttc" id="structgpr__allocation__functions_html_a1cebaedc2a76e00f773254bd16ab5f9a"><div class="ttname"><a href="structgpr__allocation__functions.html#a1cebaedc2a76e00f773254bd16ab5f9a">gpr_allocation_functions::free_fn</a></div><div class="ttdeci">void(* free_fn)(void *ptr)</div><div class="ttdef"><b>Definition:</b> alloc.h:34</div></div>
  75. <div class="ttc" id="alloc_8h_html_aa96aa61deb3f72c6e5d8f57d08942602"><div class="ttname"><a href="alloc_8h.html#aa96aa61deb3f72c6e5d8f57d08942602">gpr_get_allocation_functions</a></div><div class="ttdeci">GPRAPI gpr_allocation_functions gpr_get_allocation_functions(void)</div><div class="ttdoc">Return the family of allocation functions currently in effect. </div></div>
  76. <div class="ttc" id="alloc_8h_html_a4282437d10bb2b1a2c44d665a97984f4"><div class="ttname"><a href="alloc_8h.html#a4282437d10bb2b1a2c44d665a97984f4">gpr_realloc</a></div><div class="ttdeci">GPRAPI void * gpr_realloc(void *p, size_t size)</div><div class="ttdoc">realloc, never returns NULL </div></div>
  77. <div class="ttc" id="alloc_8h_html_ad9a7a782f4f00cad27d64d27ebbd1a72"><div class="ttname"><a href="alloc_8h.html#ad9a7a782f4f00cad27d64d27ebbd1a72">gpr_zalloc</a></div><div class="ttdeci">GPRAPI void * gpr_zalloc(size_t size)</div><div class="ttdoc">like malloc, but zero all bytes before returning them </div></div>
  78. <div class="ttc" id="alloc_8h_html_a2a32fcafdda423e2a11b4130d55951b4"><div class="ttname"><a href="alloc_8h.html#a2a32fcafdda423e2a11b4130d55951b4">gpr_set_allocation_functions</a></div><div class="ttdeci">GPRAPI void gpr_set_allocation_functions(gpr_allocation_functions functions)</div><div class="ttdoc">Request the family of allocation functions in functions be used. </div></div>
  79. <div class="ttc" id="alloc_8h_html_aa15f6aa58f356420b0d955fc6e506a60"><div class="ttname"><a href="alloc_8h.html#aa15f6aa58f356420b0d955fc6e506a60">gpr_malloc</a></div><div class="ttdeci">GPRAPI void * gpr_malloc(size_t size)</div><div class="ttdoc">malloc. </div></div>
  80. <div class="ttc" id="support_2port__platform_8h_html"><div class="ttname"><a href="support_2port__platform_8h.html">port_platform.h</a></div></div>
  81. </div><!-- fragment --></div><!-- contents -->
  82. <!-- start footer part -->
  83. <hr class="footer"/><address class="footer"><small>
  84. Generated on Tue May 15 2018 17:01:01 for GRPC C++ by &#160;<a href="http://www.doxygen.org/index.html">
  85. <img class="footer" src="doxygen.png" alt="doxygen"/>
  86. </a> 1.8.13
  87. </small></address>
  88. </body>
  89. </html>