MCPcopy Create free account
hub / github.com/dengwirda/jigsaw / _pool_alloc

Class _pool_alloc

src/libcpp/allocators/alloc_pool.hpp:70–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68 std::size_t S = 64 * 1024
69 >
70 class _pool_alloc : public A
71 {
72/*--- local memory pool: delegate to base alloc otherwise */
73 public :
74
75 typedef A base_type ;
76
77 std::size_t static constexpr pool_size = S ;
78
79 typedef typename
80 base_type::size_type size_type ;
81 typedef typename
82 base_type::diff_type diff_type ;
83
84 typedef _pool_alloc <
85 base_type ,
86 pool_size > self_type ;
87
88 private :
89
90/*-------------------------------- local allocation lists */
91 char_type* _alloc ; // pointer to block
92 char_type* _shift ; // pointer to block
93 char_type* _block ;
94 char_type* _cache ; // cached item list
95
96/*-------------------------------- local allocation sizes */
97 size_type _item_size ; // size of alloc.
98 size_type _slab_size ; // size of buffer
99
100 /*
101 --------------------------------------------------------
102 * local helper: access encoded list pointers.
103 --------------------------------------------------------
104 */
105
106 #define __nextblock(__block) \
107 *((char **)(__block + \
108 this->_slab_size*this->_item_size))
109
110 #define __nextcache(__cache) \
111 * (char **)(__cache)
112
113 #define __slabbytes \
114 this->_slab_size * \
115 this->_item_size + sizeof (char *)
116
117 /*
118 --------------------------------------------------------
119 * local helper: allocate and push new buffer.
120 --------------------------------------------------------
121 */
122
123 __inline_call void_type push_block ( // push new buffer
124 )
125 {
126 /*------------------------- allocate new buffer item */
127 char_type *_this_slab =

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected