*: Regenerate.
[gcc.git] / libstdc++-v3 / doc / html / manual / bitmap_allocator.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 21. The bitmap_allocator</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"><meta name="keywords" content="
2 ISO C++
3 ,
4 allocator
5 "><meta name="keywords" content="
6 ISO C++
7 ,
8 library
9 "><meta name="keywords" content="
10 ISO C++
11 ,
12 runtime
13 ,
14 library
15 "><link rel="home" href="../index.html" title="The GNU C++ Library"><link rel="up" href="extensions.html" title="Part III.  Extensions"><link rel="prev" href="bk01pt03ch20s05.html" title="Multiple Thread Example"><link rel="next" href="bk01pt03ch21s02.html" title="Implementation"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 21. The bitmap_allocator</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt03ch20s05.html">Prev</a> </td><th width="60%" align="center">Part III. 
16 Extensions
17
18 </th><td width="20%" align="right"> <a accesskey="n" href="bk01pt03ch21s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 21. The bitmap_allocator"><div class="titlepage"><div><div><h2 class="title"><a name="manual.ext.allocator.bitmap"></a>Chapter 21. The bitmap_allocator</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="bitmap_allocator.html#allocator.bitmap.design">Design</a></span></dt><dt><span class="section"><a href="bk01pt03ch21s02.html">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="bk01pt03ch21s02.html#bitmap.impl.free_list_store">Free List Store</a></span></dt><dt><span class="section"><a href="bk01pt03ch21s02.html#bitmap.impl.super_block">Super Block</a></span></dt><dt><span class="section"><a href="bk01pt03ch21s02.html#bitmap.impl.super_block_data">Super Block Data Layout</a></span></dt><dt><span class="section"><a href="bk01pt03ch21s02.html#bitmap.impl.max_wasted">Maximum Wasted Percentage</a></span></dt><dt><span class="section"><a href="bk01pt03ch21s02.html#bitmap.impl.allocate"><code class="function">allocate</code></a></span></dt><dt><span class="section"><a href="bk01pt03ch21s02.html#bitmap.impl.deallocate"><code class="function">deallocate</code></a></span></dt><dt><span class="section"><a href="bk01pt03ch21s02.html#bitmap.impl.questions">Questions</a></span></dt><dd><dl><dt><span class="section"><a href="bk01pt03ch21s02.html#bitmap.impl.question.1">1</a></span></dt><dt><span class="section"><a href="bk01pt03ch21s02.html#bitmap.impl.question.2">2</a></span></dt><dt><span class="section"><a href="bk01pt03ch21s02.html#bitmap.impl.question.3">3</a></span></dt></dl></dd><dt><span class="section"><a href="bk01pt03ch21s02.html#bitmap.impl.locality">Locality</a></span></dt><dt><span class="section"><a href="bk01pt03ch21s02.html#bitmap.impl.grow_policy">Overhead and Grow Policy</a></span></dt></dl></dd></dl></div><p>
19 </p><div class="section" title="Design"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="allocator.bitmap.design"></a>Design</h2></div></div></div><p>
20 As this name suggests, this allocator uses a bit-map to keep track
21 of the used and unused memory locations for its book-keeping
22 purposes.
23 </p><p>
24 This allocator will make use of 1 single bit to keep track of
25 whether it has been allocated or not. A bit 1 indicates free,
26 while 0 indicates allocated. This has been done so that you can
27 easily check a collection of bits for a free block. This kind of
28 Bitmapped strategy works best for single object allocations, and
29 with the STL type parameterized allocators, we do not need to
30 choose any size for the block which will be represented by a
31 single bit. This will be the size of the parameter around which
32 the allocator has been parameterized. Thus, close to optimal
33 performance will result. Hence, this should be used for node based
34 containers which call the allocate function with an argument of 1.
35 </p><p>
36 The bitmapped allocator's internal pool is exponentially growing.
37 Meaning that internally, the blocks acquired from the Free List
38 Store will double every time the bitmapped allocator runs out of
39 memory.
40 </p><p>
41 The macro <code class="literal">__GTHREADS</code> decides whether to use
42 Mutex Protection around every allocation/deallocation. The state
43 of the macro is picked up automatically from the gthr abstraction
44 layer.
45 </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt03ch20s05.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="extensions.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt03ch21s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Multiple Thread Example </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Implementation</td></tr></table></div></body></html>