/usr/share/doc/libloki-doc/html/a00127.html is in libloki-doc 0.1.7-3.
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 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Loki: Loki::SmallObjAllocator 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.5.8 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<form action="search.php" method="get">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><label> <u>S</u>earch for </label></td>
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
</tr>
</table>
</form>
</li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="a00192.html">Loki</a>::<a class="el" href="a00127.html">SmallObjAllocator</a>
</div>
</div>
<div class="contents">
<h1>Loki::SmallObjAllocator Class Reference<br>
<small>
[<a class="el" href="a00217.html">Internals</a>]</small>
</h1><!-- doxytag: class="Loki::SmallObjAllocator" --><code>#include <SmallObj.h></code>
<p>
<div class="dynheader">
Inheritance diagram for Loki::SmallObjAllocator:</div>
<div class="dynsection">
<center><font size="2">[<a target="top" href="graph_legend.html">legend</a>]</font></center></div>
<div class="dynheader">
Collaboration diagram for Loki::SmallObjAllocator:</div>
<div class="dynsection">
<center><font size="2">[<a target="top" href="graph_legend.html">legend</a>]</font></center></div>
<p>
<a href="a00394.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00127.html#a41bb717d552cd0df57a941def7ec607">Allocate</a> (std::size_t size, bool doThrow)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00127.html#2b669733cfa9dd157603d13d979f8c1c">Deallocate</a> (void *p, std::size_t size)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00127.html#50406896d75a2591d4bd7dc53325e3d6">Deallocate</a> (void *p)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="e49e9de3fd7b2fd93676cc1d63299b0d"></a><!-- doxytag: member="Loki::SmallObjAllocator::GetMaxObjectSize" ref="e49e9de3fd7b2fd93676cc1d63299b0d" args="() const " -->
std::size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00127.html#e49e9de3fd7b2fd93676cc1d63299b0d">GetMaxObjectSize</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns max # of bytes which this can allocate. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b1c8a2a3d7e9368ab59422ddd082105c"></a><!-- doxytag: member="Loki::SmallObjAllocator::GetAlignment" ref="b1c8a2a3d7e9368ab59422ddd082105c" args="() const " -->
std::size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00127.html#b1c8a2a3d7e9368ab59422ddd082105c">GetAlignment</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns # of bytes between allocation boundaries. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="a00127.html#6b635664b20a6984303dabde86c8ac83">TrimExcessMemory</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="a00127.html#2b7fbd5bf5fc56e45754abd2497ad18f">IsCorrupt</a> (void) const </td></tr>
<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00127.html#3d40b34b1a2d08a6bb9d9fa22ab5ce24">SmallObjAllocator</a> (std::size_t pageSize, std::size_t maxObjectSize, std::size_t objectAlignSize)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00127.html#0c861c4605844ee30dbe2a4f533fe2ae">~SmallObjAllocator</a> (void)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Manages pool of fixed-size allocators. Designed to be a non-templated base class of <a class="el" href="a00002.html">AllocatorSingleton</a> so that implementation details can be safely hidden in the source code file. <hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="3d40b34b1a2d08a6bb9d9fa22ab5ce24"></a><!-- doxytag: member="Loki::SmallObjAllocator::SmallObjAllocator" ref="3d40b34b1a2d08a6bb9d9fa22ab5ce24" args="(std::size_t pageSize, std::size_t maxObjectSize, std::size_t objectAlignSize)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Loki::SmallObjAllocator::SmallObjAllocator </td>
<td>(</td>
<td class="paramtype">std::size_t </td>
<td class="paramname"> <em>pageSize</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::size_t </td>
<td class="paramname"> <em>maxObjectSize</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::size_t </td>
<td class="paramname"> <em>objectAlignSize</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [protected]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
The only available constructor needs certain parameters in order to initialize all the FixedAllocator's. This throws only if <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>pageSize</em> </td><td># of bytes in a page of memory. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>maxObjectSize</em> </td><td>Max # of bytes which this may allocate. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>objectAlignSize</em> </td><td># of bytes between alignment boundaries. </td></tr>
</table>
</dl>
<p>References <a class="el" href="a00261.html#l01013">Loki::GetOffset()</a>.</p>
<p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</div>
</div><p>
<a class="anchor" name="0c861c4605844ee30dbe2a4f533fe2ae"></a><!-- doxytag: member="Loki::SmallObjAllocator::~SmallObjAllocator" ref="0c861c4605844ee30dbe2a4f533fe2ae" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Loki::SmallObjAllocator::~SmallObjAllocator </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>
Destructor releases all blocks, all Chunks, and FixedAllocator's. Any outstanding blocks are unavailable, and should not be used after this destructor is called. The destructor is deliberately non-virtual because it is protected, not public.
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="a41bb717d552cd0df57a941def7ec607"></a><!-- doxytag: member="Loki::SmallObjAllocator::Allocate" ref="a41bb717d552cd0df57a941def7ec607" args="(std::size_t size, bool doThrow)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void * Loki::SmallObjAllocator::Allocate </td>
<td>(</td>
<td class="paramtype">std::size_t </td>
<td class="paramname"> <em>size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>doThrow</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Allocates a block of memory of requested size. Complexity is often constant-time, but might be O(C) where C is the number of Chunks in a <a class="el" href="a00056.html">FixedAllocator</a>.<p>
<dl class="user" compact><dt><b>Exception Safety Level</b></dt><dd>Provides either strong-exception safety, or no-throw exception-safety level depending upon doThrow parameter. The reason it provides two levels of exception safety is because it is used by both the nothrow and throwing new operators. The underlying implementation will never throw of its own accord, but this can decide to throw if it does not allocate. The only exception it should emit is std::bad_alloc.</dd></dl>
<dl class="user" compact><dt><b>Allocation Failure</b></dt><dd>If it does not allocate, it will call TrimExcessMemory and attempt to allocate again, before it decides to throw or return NULL. Many allocators loop through several new_handler functions, and terminate if they can not allocate, but not this one. It only makes one attempt using its own implementation of the new_handler, and then returns NULL or throws so that the program can decide what to do at a higher level. (Side note: Even though the C++ Standard allows allocators and new_handlers to terminate if they fail, the <a class="el" href="a00192.html">Loki</a> allocator does not do that since that policy is not polite to a host program.)</dd></dl>
<dl compact><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 bytes needed for allocation. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>doThrow</em> </td><td>True if this should throw if unable to allocate, false if it should provide no-throw exception safety level. </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>NULL if nothing allocated and doThrow is false. Else the pointer to an available block of memory. </dd></dl>
<p>References <a class="el" href="a00261.html#l00831">Loki::FixedAllocator::Allocate()</a>, <a class="el" href="a00261.html#l00256">Loki::FixedAllocator::BlockSize()</a>, <a class="el" href="a00261.html#l01028">Loki::DefaultAllocator()</a>, <a class="el" href="a00262.html#l00157">GetAlignment()</a>, <a class="el" href="a00262.html#l00153">GetMaxObjectSize()</a>, <a class="el" href="a00261.html#l01013">Loki::GetOffset()</a>, and <a class="el" href="a00261.html#l01088">TrimExcessMemory()</a>.</p>
<p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</div>
</div><p>
<a class="anchor" name="50406896d75a2591d4bd7dc53325e3d6"></a><!-- doxytag: member="Loki::SmallObjAllocator::Deallocate" ref="50406896d75a2591d4bd7dc53325e3d6" args="(void *p)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Loki::SmallObjAllocator::Deallocate </td>
<td>(</td>
<td class="paramtype">void * </td>
<td class="paramname"> <em>p</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Deallocates a block of memory at a given place but of unknown size size. Complexity is O(F + C) where F is the count of FixedAllocator's in the pool, and C is the number of Chunks in all FixedAllocator's. This does not throw exceptions. This overloaded version of Deallocate is called by the nothow delete operator - which is called when the nothrow new operator is used, but a constructor throws an exception.
<p>References <a class="el" href="a00261.html#l00888">Loki::FixedAllocator::Deallocate()</a>, <a class="el" href="a00261.html#l01049">Loki::DefaultDeallocator()</a>, <a class="el" href="a00262.html#l00157">GetAlignment()</a>, <a class="el" href="a00262.html#l00153">GetMaxObjectSize()</a>, <a class="el" href="a00261.html#l01013">Loki::GetOffset()</a>, and <a class="el" href="a00261.html#l00722">Loki::FixedAllocator::HasBlock()</a>.</p>
<p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</div>
</div><p>
<a class="anchor" name="2b669733cfa9dd157603d13d979f8c1c"></a><!-- doxytag: member="Loki::SmallObjAllocator::Deallocate" ref="2b669733cfa9dd157603d13d979f8c1c" args="(void *p, std::size_t size)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Loki::SmallObjAllocator::Deallocate </td>
<td>(</td>
<td class="paramtype">void * </td>
<td class="paramname"> <em>p</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::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>
Deallocates a block of memory at a given place and of a specific size. Complexity is almost always constant-time, and is O(C) only if it has to search for which <a class="el" href="a00025.html">Chunk</a> deallocates. This never throws.
<p>References <a class="el" href="a00261.html#l00256">Loki::FixedAllocator::BlockSize()</a>, <a class="el" href="a00261.html#l00888">Loki::FixedAllocator::Deallocate()</a>, <a class="el" href="a00261.html#l01049">Loki::DefaultDeallocator()</a>, <a class="el" href="a00262.html#l00157">GetAlignment()</a>, <a class="el" href="a00262.html#l00153">GetMaxObjectSize()</a>, and <a class="el" href="a00261.html#l01013">Loki::GetOffset()</a>.</p>
<p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</div>
</div><p>
<a class="anchor" name="2b7fbd5bf5fc56e45754abd2497ad18f"></a><!-- doxytag: member="Loki::SmallObjAllocator::IsCorrupt" ref="2b7fbd5bf5fc56e45754abd2497ad18f" args="(void) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool Loki::SmallObjAllocator::IsCorrupt </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"> </td>
<td> ) </td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns true if anything in implementation is corrupt. Complexity is O(F + C + B) where F is the count of FixedAllocator's in the pool, C is the number of Chunks in all FixedAllocator's, and B is the number of blocks in all Chunks. If it determines any data is corrupted, this will return true in release version, but assert in debug version at the line where it detects the corrupted data. If it does not detect any corrupted data, it returns false.
<p>References <a class="el" href="a00262.html#l00157">GetAlignment()</a>, <a class="el" href="a00262.html#l00153">GetMaxObjectSize()</a>, and <a class="el" href="a00261.html#l01013">Loki::GetOffset()</a>.</p>
<p>Referenced by <a class="el" href="a00262.html#l00303">Loki::AllocatorSingleton< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >::IsCorrupted()</a>.</p>
<p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</div>
</div><p>
<a class="anchor" name="6b635664b20a6984303dabde86c8ac83"></a><!-- doxytag: member="Loki::SmallObjAllocator::TrimExcessMemory" ref="6b635664b20a6984303dabde86c8ac83" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool Loki::SmallObjAllocator::TrimExcessMemory </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Releases empty Chunks from memory. Complexity is O(F + C) where F is the count of FixedAllocator's in the pool, and C is the number of Chunks in all FixedAllocator's. This will never throw. This is called by AllocatorSingleto::ClearExtraMemory, the new_handler function for Loki's allocator, and is called internally when an allocation fails. <dl class="return" compact><dt><b>Returns:</b></dt><dd>True if any memory released, or false if none released. </dd></dl>
<p>References <a class="el" href="a00262.html#l00157">GetAlignment()</a>, <a class="el" href="a00262.html#l00153">GetMaxObjectSize()</a>, and <a class="el" href="a00261.html#l01013">Loki::GetOffset()</a>.</p>
<p>Referenced by <a class="el" href="a00261.html#l01109">Allocate()</a>, and <a class="el" href="a00262.html#l00287">Loki::AllocatorSingleton< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >::ClearExtraMemory()</a>.</p>
<p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</div>
</div><p>
<hr>The documentation for this class was generated from the following files:<ul>
<li>SmallObj.h<li>SmallObj.cpp</ul>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Thu Jan 29 18:51:45 2009 for Loki by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>
|