1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
---|
2 | "http://www.w3.org/TR/html4/loose.dtd"> |
---|
3 | |
---|
4 | <html> |
---|
5 | <head> |
---|
6 | <meta http-equiv="Content-Language" content="en-us"> |
---|
7 | <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> |
---|
8 | <link href="pool.css" rel="stylesheet" type="text/css"> |
---|
9 | |
---|
10 | <title>Boost Pool Library</title> |
---|
11 | </head> |
---|
12 | |
---|
13 | <body> |
---|
14 | <img src="../../../boost.png" width="276" height="86" alt="C++ Boost"> |
---|
15 | |
---|
16 | <h1 align="center">Boost Pool Library</h1> |
---|
17 | |
---|
18 | <h2>Introduction</h2> |
---|
19 | |
---|
20 | <h3>What is Pool?</h3> |
---|
21 | |
---|
22 | <p>Pool allocation is a memory allocation scheme that is very fast, but |
---|
23 | limited in its usage. For more information on pool allocation (also called |
---|
24 | "simple segregated storage"), see <a href="concepts.html">the concepts |
---|
25 | document</a>.</p> |
---|
26 | |
---|
27 | <h3>Why should I use Pool?</h3> |
---|
28 | |
---|
29 | <p>Using Pools gives you more control over how memory is used in your |
---|
30 | program. For example, you could have a situation where you want to allocate |
---|
31 | a bunch of small objects at one point, and then reach a point in your |
---|
32 | program where none of them are needed any more. Using pool interfaces, you |
---|
33 | can choose to run their destructors or just drop them off into oblivion; the |
---|
34 | pool interface will guarantee that there are no system memory leaks.</p> |
---|
35 | |
---|
36 | <h3>When should I use Pool?</h3> |
---|
37 | |
---|
38 | <p>Pools are generally used when there is a lot of allocation and |
---|
39 | deallocation of small objects. Another common usage is the situation above, |
---|
40 | where many objects may be dropped out of memory.</p> |
---|
41 | |
---|
42 | <p>In general, use Pools when you need a more efficient way to do unusual |
---|
43 | memory control.</p> |
---|
44 | |
---|
45 | <h3>How do I use Pool?</h3> |
---|
46 | |
---|
47 | <p>See the <a href="interfaces.html">pool interfaces document</a>, which |
---|
48 | covers the different Pool interfaces supplied by this library.</p> |
---|
49 | |
---|
50 | <h2>Library Structure and Dependencies</h2> |
---|
51 | |
---|
52 | <p>Forward declarations of all the exposed symbols for this library are in |
---|
53 | the header <span class="code"><boost/pool/poolfwd.hpp></span>.</p> |
---|
54 | |
---|
55 | <p>The library may use macros, which will be prefixed with <span class= |
---|
56 | "code">BOOST_POOL_</span>. The exception to this rule are the include file |
---|
57 | guards, which (for file <em>xxx</em>.hpp) is <span class= |
---|
58 | "code">BOOST_<em>xxx</em>_HPP</span>.</p> |
---|
59 | |
---|
60 | <p>All exposed symbols defined by the library will be in namespace |
---|
61 | <span class="code">boost</span>. All symbols used only by the implementation |
---|
62 | will be in namespace <span class= |
---|
63 | "code">boost::details::pool</span>.</p> |
---|
64 | |
---|
65 | <p>Every header used only by the implementation is in the subdirectory |
---|
66 | <span class="code">detail/</span>.</p> |
---|
67 | |
---|
68 | <p>Any header in the library may include any other header in the library or |
---|
69 | any system-supplied header at its discretion.</p> |
---|
70 | |
---|
71 | <h2>Installation</h2> |
---|
72 | |
---|
73 | <p>The Boost Pool library is a header file library. That means there is no |
---|
74 | .lib, .dll, or .so to build; just add the Boost directory to your compiler's |
---|
75 | include file path, and you should be good to go!</p> |
---|
76 | |
---|
77 | <h2>Building the Test Programs</h2> |
---|
78 | |
---|
79 | <p>The subdirectory "build" contains subdirectories for several different |
---|
80 | platforms. These subdirectories contain all necessary work-around code for |
---|
81 | that platform, as well as makefiles or IDE project files as appropriate.</p> |
---|
82 | |
---|
83 | <p>Read the "readme.txt" in the proper subdirectory, if it exists.</p> |
---|
84 | |
---|
85 | <p>The standard makefile targets are "all", "clean" (which deletes any |
---|
86 | intermediate files), and "veryclean" (which deletes any intermediate files |
---|
87 | and executables). All intermediate and executable files are built in the |
---|
88 | same directory as the makefile/project file. If there is a project file |
---|
89 | supplied instead of a makefile, "clean" and "veryclean" shell scripts/batch |
---|
90 | files will be provided.</p> |
---|
91 | |
---|
92 | <p>Project files and makefiles for additional platforms may be sent to |
---|
93 | Stephen Cleary at scleary AT jerviswebb DOT com.</p> |
---|
94 | |
---|
95 | <h2>Documentation Map</h2> |
---|
96 | |
---|
97 | <ul> |
---|
98 | <li>Overview of Pooling |
---|
99 | |
---|
100 | <ul> |
---|
101 | <li><a href="concepts.html">concepts.html</a> - The basic ideas behind |
---|
102 | pooling.</li> |
---|
103 | |
---|
104 | <li><a href= |
---|
105 | "implementation/alignment.html">implementation/alignment.html</a> - |
---|
106 | How we guarantee alignment portably.</li> |
---|
107 | |
---|
108 | <li><a href="interfaces.html">interfaces.html</a> - What interfaces |
---|
109 | are provided and when to use each one.</li> |
---|
110 | </ul> |
---|
111 | </li> |
---|
112 | |
---|
113 | <li>Pool Exposed Interfaces |
---|
114 | |
---|
115 | <ul> |
---|
116 | <li><a href= |
---|
117 | "interfaces/simple_segregated_storage.html"> |
---|
118 | interfaces/simple_segregated_storage.html</a> |
---|
119 | - Not for the faint of heart; embedded programmers only.</li> |
---|
120 | |
---|
121 | <li><a href="interfaces/pool.html">interfaces/pool.html</a> - The |
---|
122 | basic pool interface.</li> |
---|
123 | |
---|
124 | <li><a href= |
---|
125 | "interfaces/singleton_pool.html">interfaces/singleton_pool.html</a> - |
---|
126 | The basic pool interface as a thread-safe singleton.</li> |
---|
127 | |
---|
128 | <li><a href= |
---|
129 | "interfaces/object_pool.html">interfaces/object_pool.html</a> - A |
---|
130 | type-oriented (instead of size-oriented) pool interface.</li> |
---|
131 | |
---|
132 | <li><a href= |
---|
133 | "interfaces/pool_alloc.html">interfaces/pool_alloc.html</a> - A |
---|
134 | Standard Allocator pool interface based on singleton_pool.</li> |
---|
135 | |
---|
136 | <li><a href= |
---|
137 | "interfaces/user_allocator.html">interfaces/user_allocator.html</a> - |
---|
138 | OK, not a pool interface, but it describes how the user can control |
---|
139 | how Pools allocate system memory.</li> |
---|
140 | </ul> |
---|
141 | </li> |
---|
142 | |
---|
143 | <li>Pool Implementation Details and Extensions |
---|
144 | |
---|
145 | <ul> |
---|
146 | <li>Interface Implementations and Extensions |
---|
147 | |
---|
148 | <ul> |
---|
149 | <li><a href= |
---|
150 | "implementation/simple_segregated_storage.html"> |
---|
151 | implementation/simple_segregated_storage.html</a></li> |
---|
152 | |
---|
153 | <li><a href= |
---|
154 | "implementation/pool.html">implementation/pool.html</a></li> |
---|
155 | |
---|
156 | <li><a href= |
---|
157 | "implementation/singleton_pool.html"> |
---|
158 | implementation/singleton_pool.html</a></li> |
---|
159 | |
---|
160 | <li><a href= |
---|
161 | "implementation/object_pool.html">implementation/object_pool.html</a></li> |
---|
162 | |
---|
163 | <li><a href= |
---|
164 | "implementation/pool_alloc.html">implementation/pool_alloc.html</a></li> |
---|
165 | </ul> |
---|
166 | </li> |
---|
167 | |
---|
168 | <li>Components Used Only by the Implementation |
---|
169 | |
---|
170 | <ul> |
---|
171 | <li><a href= |
---|
172 | "implementation/ct_gcd_lcm.html">implementation/ct_gcd_lcm.html</a> |
---|
173 | - Compile-time GCD and LCM.</li> |
---|
174 | |
---|
175 | <li><a href="implementation/for.html">implementation/for.html</a> |
---|
176 | - Description of an m4 component.</li> |
---|
177 | |
---|
178 | <li><a href= |
---|
179 | "implementation/gcd_lcm.html">implementation/gcd_lcm.html</a> - |
---|
180 | Run-time GCD and LCM.</li> |
---|
181 | |
---|
182 | <li><a href= |
---|
183 | "implementation/guard.html">implementation/guard.html</a> - Auto |
---|
184 | lock/unlock for mutex.</li> |
---|
185 | |
---|
186 | <li><a href= |
---|
187 | "implementation/mutex.html">implementation/mutex.html</a> - |
---|
188 | Platform-dependent mutex type.</li> |
---|
189 | |
---|
190 | <li><a href= |
---|
191 | "implementation/pool_construct.html"> |
---|
192 | implementation/pool_construct.html</a> |
---|
193 | - The system for supporting more constructor arguments in |
---|
194 | object_pool.</li> |
---|
195 | |
---|
196 | <li><a href= |
---|
197 | "implementation/singleton.html">implementation/singleton.html</a> |
---|
198 | - Singleton that avoids static initialization problem.</li> |
---|
199 | </ul> |
---|
200 | </li> |
---|
201 | </ul> |
---|
202 | </li> |
---|
203 | </ul> |
---|
204 | |
---|
205 | <h2>Future Directions</h2> |
---|
206 | |
---|
207 | <p>Another pool interface will be written: a base class for per-class pool |
---|
208 | allocation.</p> |
---|
209 | |
---|
210 | <h2>Acknowledgements</h2> |
---|
211 | |
---|
212 | <p>Many, many thanks to the Boost peers, notably Jeff Garland, Beman Dawes, |
---|
213 | Ed Brey, Gary Powell, Peter Dimov, and Jens Maurer for providing helpful |
---|
214 | suggestions!</p> |
---|
215 | <hr> |
---|
216 | |
---|
217 | <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src= |
---|
218 | "http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" |
---|
219 | height="31" width="88"></a></p> |
---|
220 | |
---|
221 | <p>Revised |
---|
222 | <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->05 December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38516" --></p> |
---|
223 | |
---|
224 | <p><i>Copyright © 2000, 2001 Stephen Cleary (scleary AT jerviswebb DOT com)</i></p> |
---|
225 | |
---|
226 | <p><i>Distributed under the Boost Software License, Version 1.0. (See |
---|
227 | accompanying file <a href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or |
---|
228 | copy at <a href= |
---|
229 | "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p> |
---|
230 | </body> |
---|
231 | </html> |
---|