template<class Allocator, unsigned MinSize, unsigned MaxSize, unsigned StepSize>
class alb::v_100::bucketizer< Allocator, MinSize, MaxSize, StepSize >
The Bucketizer is intended to hold allocators with StepSize increasing buckets, within the range of [MinSize, MaxSize) E.g. MinSize = 17, MaxSize = 64, StepSize = 16 => BucketsSize[17, 32][33 48][48 64] It plays very well together with alb::freelist or alb::shared_freelist After instantiation any instance is as far thread safe as the Allocator is thread safe.
- Template Parameters
-
Allocator | Specifies which shall be handled in a bucketized way |
MinSize | The minimum size of the first bucket item |
MaxSize | The upper size of the last bucket item |
StepSize | The equidistant step size of the size of all buckets |
Definition at line 36 of file bucketizer.hpp.
template<class Allocator , unsigned MinSize, unsigned MaxSize, unsigned StepSize>
Allocates the requested number of bytes. The request is forwarded to the bucket with which edges are at [min,max] bytes.
- Parameters
-
n | The number of bytes to be allocated |
- Returns
- The Block describing the allocated memory
Definition at line 70 of file bucketizer.hpp.
template<class Allocator , unsigned MinSize, unsigned MaxSize, unsigned StepSize>
template<typename U = Allocator>
Deallocates all resources. Beware of possible dangling pointers! This method is only available if Allocator::deallocate_all is available
Definition at line 149 of file bucketizer.hpp.
template<class Allocator , unsigned MinSize, unsigned MaxSize, unsigned StepSize>
Forwards the reallocation of the given block to the corresponding bucket item. If the length of the given block and the specified new size crosses the boundary of a bucket, then content memory of the block is moved to the new bucket item
- Parameters
-
b | Then Block its size should be changed |
n | The new size of the block. |
- Returns
- True, if the reallocation was successful.
Definition at line 102 of file bucketizer.hpp.