Allocator Builder
Policy Based C++ Template Allocator Library
|
#include <aligned_mallocator.hpp>
Public Member Functions | |
block | allocate (size_t n) noexcept |
bool | reallocate (block &b, size_t n) noexcept |
void | deallocate (block &b) noexcept |
Static Public Attributes | |
static constexpr bool | supports_truncated_deallocation = false |
This class implements a proxy to the system ::malloc() with the ALB interface. According the template * parameter DefaultAlignment the allocated values are aligned to the specific boundary in bytes. Normally this should be a multiple of at least 4 bytes.
DefaultAlignment | Specified the alignment in bytes of all allocation and reallocations. |
Definition at line 27 of file aligned_mallocator.hpp.
|
inlinenoexcept |
Allocates rounded up to the defined alignment the number of bytes. If the system cannot allocate the specified amount of memory then a null Block is returned.
Definition at line 77 of file aligned_mallocator.hpp.
|
inlinenoexcept |
Frees the given block back to the system. The block gets nulled.
b | The block, describing what memory shall be freed. |
Definition at line 109 of file aligned_mallocator.hpp.
|
inlinenoexcept |
The given block is reallocated to the given size. The new size is aligned to specified alignment. It depends to the OS, if the provided memory block is expanded or moved. It is guaranteed that the values of min(b.length, n) bytes are preserved.
b | The block that should be reallocated |
n | The new size of the block |
Definition at line 96 of file aligned_mallocator.hpp.