BitMagic-C++
|
BM style allocator adapter. More...
#include <bmalloc.h>
Public Types | |
typedef BA | block_allocator_type |
typedef PA | ptr_allocator_type |
typedef APool | allocator_pool_type |
Public Member Functions | |
mem_alloc (const BA &block_alloc=BA(), const PA &ptr_alloc=PA()) BMNOEXCEPT | |
mem_alloc (const mem_alloc &ma) BMNOEXCEPT | |
mem_alloc & | operator= (const mem_alloc &ma) BMNOEXCEPT |
block_allocator_type | get_block_allocator () const BMNOEXCEPT |
Returns copy of the block allocator object. | |
ptr_allocator_type | get_ptr_allocator () const BMNOEXCEPT |
Returns copy of the ptr allocator object. | |
void | set_pool (allocator_pool_type *pool) BMNOEXCEPT |
set pointer to external pool | |
allocator_pool_type * | get_pool () BMNOEXCEPT |
get pointer to allocation pool (if set) | |
bm::word_t * | alloc_bit_block (unsigned alloc_factor=1) |
Allocates and returns bit block. | |
void | free_bit_block (bm::word_t *block, unsigned alloc_factor=1) BMNOEXCEPT |
Frees bit block allocated by alloc_bit_block. | |
bm::gap_word_t * | alloc_gap_block (unsigned level, const bm::gap_word_t *glevel_len) |
Allocates GAP block using bit block allocator (BA). | |
void | free_gap_block (bm::gap_word_t *block, const bm::gap_word_t *glevel_len) |
Frees GAP block using bot block allocator (BA) | |
void * | alloc_ptr (size_t size) |
Allocates block of pointers. | |
void | free_ptr (void *p, size_t size) BMNOEXCEPT |
Frees block of pointers. | |
BM style allocator adapter.
Template takes parameters: BA - allocator object for bit blocks PA - allocator object for pointer blocks APool - Allocation pool
typedef APool bm::mem_alloc< BA, PA, APool >::allocator_pool_type |
typedef BA bm::mem_alloc< BA, PA, APool >::block_allocator_type |
typedef PA bm::mem_alloc< BA, PA, APool >::ptr_allocator_type |
|
inline |
|
inline |
|
inline |
Allocates and returns bit block.
alloc_factor | indicated how many blocks we want to allocate in chunk total allocation is going to be bm::set_block_size * alloc_factor Default allocation factor is 1 |
Definition at line 316 of file bmalloc.h.
References bm::set_block_size.
|
inline |
Allocates GAP block using bit block allocator (BA).
GAP blocks in BM library belong to levels. Each level has a correspondent length described in bm::gap_len_table<>
level | GAP block level. |
glevel_len | table of level lengths |
Definition at line 342 of file bmalloc.h.
References BM_ASSERT, and bm::gap_levels.
|
inline |
|
inline |
Frees bit block allocated by alloc_bit_block.
Definition at line 325 of file bmalloc.h.
References BM_ASSERT, IS_VALID_ADDR, and bm::set_block_size.
|
inline |
Frees GAP block using bot block allocator (BA)
Definition at line 354 of file bmalloc.h.
References BM_ASSERT, bm::gap_capacity(), and IS_VALID_ADDR.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |