/usr/share/doc/libucommon-dev/a00080.html is in libucommon-doc 3.2.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | <!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"/>
<title>UCommon: ucc::memalloc Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="classes.html"><span>Data Structure Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Data Fields</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="a00214.html">ucc</a>::<a class="el" href="a00080.html">memalloc</a>
</div>
</div>
<div class="contents">
<h1>ucc::memalloc Class Reference</h1><!-- doxytag: class="ucc::memalloc" -->
<p>An alternate memory pager private heap manager.
<a href="#_details">More...</a></p>
<p><code>#include <<a class="el" href="a00197_source.html">memory.h</a>></code></p>
<div class="dynheader">
Inheritance diagram for ucc::memalloc:</div>
<div class="dynsection">
<div class="center"><img src="a00438.png" border="0" usemap="#ucc_1_1memalloc_inherit__map" alt="Inheritance graph"/></div>
<map name="ucc_1_1memalloc_inherit__map" id="ucc_1_1memalloc_inherit__map">
<area shape="rect" id="node3" href="a00062.html" title="Traditional keypair config file parsing class." alt="" coords="109,83,200,112"/><area shape="rect" id="node5" href="a00081.html" title="A managed private heap for small allocations." alt="" coords="224,83,347,112"/><area shape="rect" id="node15" href="a00119.html" title="Compiled script container." alt="" coords="371,83,456,112"/><area shape="rect" id="node17" href="a00124.html" title="An instance of the runtime interpreter." alt="" coords="493,83,624,112"/><area shape="rect" id="node7" href="a00059.html" title="A class to hold memory pointers referenced by string names." alt="" coords="63,160,172,189"/><area shape="rect" id="node11" href="a00065.html" title="A templated class for a hash pager." alt="" coords="196,160,361,189"/><area shape="rect" id="node13" href="a00142.html" title="A utility class for generic shell operations." alt="" coords="385,160,465,189"/><area shape="rect" id="node9" href="a00019.html" title="A typed template for using a key association with typed objects." alt="" coords="5,237,229,267"/><area shape="rect" id="node19" href="a00127.html" title="Runtime methods collection class." alt="" coords="489,160,641,189"/></map>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00080.html#a086ccd141c4e5d57d91c50eb27923612">alloc</a> (size_t size)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Allocate memory from the pager heap. <a href="#a086ccd141c4e5d57d91c50eb27923612"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00080.html#abe5ef90bf1698a890377c6541a6bbb1c">dup</a> (void *memory, size_t size)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Duplicate existing memory block into allocated memory. <a href="#abe5ef90bf1698a890377c6541a6bbb1c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00080.html#a0790234f08af30a0da6430552fbcdc1d">dup</a> (const char *<a class="el" href="a00157.html">string</a>)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Duplicate NULL terminated string into allocated memory. <a href="#a0790234f08af30a0da6430552fbcdc1d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">unsigned </td><td class="memItemRight" valign="bottom"><a class="el" href="a00080.html#a2d2c6d0caa2a0da8b743073b10f8d3fc">getAlloc</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the size of a memory page. <a href="#a2d2c6d0caa2a0da8b743073b10f8d3fc"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">unsigned </td><td class="memItemRight" valign="bottom"><a class="el" href="a00080.html#a437ccce5e21fee3a19ce5de11911c59a">getLimit</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the maximum number of pages that are permitted. <a href="#a437ccce5e21fee3a19ce5de11911c59a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">unsigned </td><td class="memItemRight" valign="bottom"><a class="el" href="a00080.html#a1a312654ab07979eca953a1ee54a55c9">getPages</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the number of pages that have been allocated from the real heap. <a href="#a1a312654ab07979eca953a1ee54a55c9"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00080.html#a53e04decc4d73be05f391af8c6fb1411">memalloc</a> (size_t page=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Construct a memory pager. <a href="#a53e04decc4d73be05f391af8c6fb1411"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a35bd2c59ecc2ab6a04e7bf9d9bd92b24"></a><!-- doxytag: member="ucc::memalloc::purge" ref="a35bd2c59ecc2ab6a04e7bf9d9bd92b24" args="(void)" -->
void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00080.html#a35bd2c59ecc2ab6a04e7bf9d9bd92b24">purge</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Purge all allocated memory and heap pages immediately. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">unsigned </td><td class="memItemRight" valign="bottom"><a class="el" href="a00080.html#afe93dc2c37b8f03255e6b71e5bfd6e15">utilization</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Determine fragmentation level of acquired heap pages. <a href="#afe93dc2c37b8f03255e6b71e5bfd6e15"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00080.html#a4d46bf82a4c340d10a6e96333e0c9b8b">zalloc</a> (size_t size)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Allocate memory from the pager heap. <a href="#a4d46bf82a4c340d10a6e96333e0c9b8b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="a00080.html#a79d3b132b8df957676a1aeb392b675c8">~memalloc</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Destroy a memory pager. <a href="#a79d3b132b8df957676a1aeb392b675c8"></a><br/></td></tr>
<tr><td colspan="2"><h2>Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">page_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00080.html#a2cdf8a917cc0437758fdb6abac744ed5">pager</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Acquire a new page from the heap. <a href="#a2cdf8a917cc0437758fdb6abac744ed5"></a><br/></td></tr>
<tr><td colspan="2"><h2>Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa32e00f97b9e9f3152753332e7b65b49"></a><!-- doxytag: member="ucc::memalloc::limit" ref="aa32e00f97b9e9f3152753332e7b65b49" args="" -->
unsigned </td><td class="memItemRight" valign="bottom"><b>limit</b></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>An alternate memory pager private heap manager. </p>
<p>This is used to allocate in an optimized manner, as it assumes no mutex locks are held or used as part of it's own internal processing. It also is designed for optimized performance. </p>
<dl class="author"><dt><b>Author:</b></dt><dd>David Sugar <<a href="mailto:dyfet@gnutelephony.org">dyfet@gnutelephony.org</a>> </dd></dl>
<p>Definition at line <a class="el" href="a00197_source.html#l00052">52</a> of file <a class="el" href="a00197_source.html">memory.h</a>.</p>
<hr/><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" id="a53e04decc4d73be05f391af8c6fb1411"></a><!-- doxytag: member="ucc::memalloc::memalloc" ref="a53e04decc4d73be05f391af8c6fb1411" args="(size_t page=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">ucc::memalloc::memalloc </td>
<td>(</td>
<td class="paramtype">size_t </td>
<td class="paramname"> <em>page</em> = <code>0</code></td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Construct a memory pager. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>page</em> </td><td>size to use or 0 for OS allocation size. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a79d3b132b8df957676a1aeb392b675c8"></a><!-- doxytag: member="ucc::memalloc::~memalloc" ref="a79d3b132b8df957676a1aeb392b675c8" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual ucc::memalloc::~memalloc </td>
<td>(</td>
<td class="paramname"></td>
<td> ) </td>
<td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Destroy a memory pager. </p>
<p>Release all pages back to the heap at once. </p>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a086ccd141c4e5d57d91c50eb27923612"></a><!-- doxytag: member="ucc::memalloc::alloc" ref="a086ccd141c4e5d57d91c50eb27923612" args="(size_t size)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual void* ucc::memalloc::alloc </td>
<td>(</td>
<td class="paramtype">size_t </td>
<td class="paramname"> <em>size</em></td>
<td> ) </td>
<td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Allocate memory from the pager heap. </p>
<p>The size of the request must be less than the size of the memory page used. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>size</em> </td><td>of memory request. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>allocated memory or NULL if not possible. </dd></dl>
<p>Reimplemented in <a class="el" href="a00081.html#a17e3fb857ffb0ab3cf51eba123636071">ucc::mempager</a>.</p>
</div>
</div>
<a class="anchor" id="abe5ef90bf1698a890377c6541a6bbb1c"></a><!-- doxytag: member="ucc::memalloc::dup" ref="abe5ef90bf1698a890377c6541a6bbb1c" args="(void *memory, size_t size)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void* ucc::memalloc::dup </td>
<td>(</td>
<td class="paramtype">void * </td>
<td class="paramname"> <em>memory</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"> <em>size</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Duplicate existing memory block into allocated memory. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>memory</em> </td><td>to data copy from. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>size</em> </td><td>of memory to allocate. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>allocated memory with copy or NULL if cannot allocate. </dd></dl>
<p>Reimplemented in <a class="el" href="a00081.html#abcdb91d05edcfcd878902b6ab28af444">ucc::mempager</a>.</p>
</div>
</div>
<a class="anchor" id="a0790234f08af30a0da6430552fbcdc1d"></a><!-- doxytag: member="ucc::memalloc::dup" ref="a0790234f08af30a0da6430552fbcdc1d" args="(const char *string)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* ucc::memalloc::dup </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"> <em>string</em></td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Duplicate NULL terminated string into allocated memory. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>string</em> </td><td>to copy into memory. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>allocated memory with copy of string or NULL if cannot allocate. </dd></dl>
<p>Reimplemented in <a class="el" href="a00081.html#a7fa56e7c899d9e471a42512d670f866e">ucc::mempager</a>.</p>
</div>
</div>
<a class="anchor" id="a2d2c6d0caa2a0da8b743073b10f8d3fc"></a><!-- doxytag: member="ucc::memalloc::getAlloc" ref="a2d2c6d0caa2a0da8b743073b10f8d3fc" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned ucc::memalloc::getAlloc </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Get the size of a memory page. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>size of each pager heap allocation. </dd></dl>
<p>Definition at line <a class="el" href="a00197_source.html#l00110">110</a> of file <a class="el" href="a00197_source.html">memory.h</a>.</p>
</div>
</div>
<a class="anchor" id="a437ccce5e21fee3a19ce5de11911c59a"></a><!-- doxytag: member="ucc::memalloc::getLimit" ref="a437ccce5e21fee3a19ce5de11911c59a" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned ucc::memalloc::getLimit </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Get the maximum number of pages that are permitted. </p>
<p>One can use a derived class to set and enforce a maximum limit to the number of pages that will be allocated from the real heap. This is often used to detect and bring down apps that are leaking. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>page allocation limit. </dd></dl>
<p>Definition at line <a class="el" href="a00197_source.html#l00103">103</a> of file <a class="el" href="a00197_source.html">memory.h</a>.</p>
</div>
</div>
<a class="anchor" id="a1a312654ab07979eca953a1ee54a55c9"></a><!-- doxytag: member="ucc::memalloc::getPages" ref="a1a312654ab07979eca953a1ee54a55c9" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned ucc::memalloc::getPages </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Get the number of pages that have been allocated from the real heap. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>pages allocated from heap. </dd></dl>
<p>Reimplemented in <a class="el" href="a00019.html#a70512faabc83984d38f8cc6ea00d6791">ucc::assoc_pointer< T, I, M, P ></a>.</p>
<p>Definition at line <a class="el" href="a00197_source.html#l00093">93</a> of file <a class="el" href="a00197_source.html">memory.h</a>.</p>
</div>
</div>
<a class="anchor" id="a2cdf8a917cc0437758fdb6abac744ed5"></a><!-- doxytag: member="ucc::memalloc::pager" ref="a2cdf8a917cc0437758fdb6abac744ed5" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">page_t* ucc::memalloc::pager </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td>
<td> ) </td>
<td><code> [protected]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Acquire a new page from the heap. </p>
<p>This is mostly used internally. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>page structure of the newly aquired memory page. </dd></dl>
</div>
</div>
<a class="anchor" id="afe93dc2c37b8f03255e6b71e5bfd6e15"></a><!-- doxytag: member="ucc::memalloc::utilization" ref="afe93dc2c37b8f03255e6b71e5bfd6e15" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned ucc::memalloc::utilization </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Determine fragmentation level of acquired heap pages. </p>
<p>This is represented as an average % utilization (0-100) and represents the used portion of each allocated heap page vs the page size. Since requests that cannot fit on an already allocated page are moved into a new page, there is some unusable space left over at the end of the page. When utilization approaches 100, this is good. A low utilization may suggest a larger page size should be used. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>pager utilization. </dd></dl>
<p>Reimplemented in <a class="el" href="a00081.html#ad8df15dd4848802c7dd79f8a81719f88">ucc::mempager</a>, and <a class="el" href="a00019.html#af3c27c6db90fa61408f11faf7c062cb7">ucc::assoc_pointer< T, I, M, P ></a>.</p>
</div>
</div>
<a class="anchor" id="a4d46bf82a4c340d10a6e96333e0c9b8b"></a><!-- doxytag: member="ucc::memalloc::zalloc" ref="a4d46bf82a4c340d10a6e96333e0c9b8b" args="(size_t size)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void* ucc::memalloc::zalloc </td>
<td>(</td>
<td class="paramtype">size_t </td>
<td class="paramname"> <em>size</em></td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Allocate memory from the pager heap. </p>
<p>The size of the request must be less than the size of the memory page used. The memory is initialized to zero. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>size</em> </td><td>of memory request. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>allocated memory or NULL if not possible. </dd></dl>
<p>Reimplemented in <a class="el" href="a00081.html#ab2115ea0eed89545c8fd70e1b3fd2aad">ucc::mempager</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>ucommon/<a class="el" href="a00197_source.html">memory.h</a></li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Tue Jul 6 08:22:34 2010 for UCommon by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>
|