BDE 4.14.0 Production release
|
#include <bdlma_heapbypassallocator.h>
Public Member Functions | |
HeapBypassAllocator () | |
HeapBypassAllocator (size_type replenishHint) | |
~HeapBypassAllocator () BSLS_KEYWORD_OVERRIDE | |
void * | allocate (bsls::Types::size_type size) BSLS_KEYWORD_OVERRIDE |
void | deallocate (void *) BSLS_KEYWORD_OVERRIDE |
This method has no effect for this heap bypass allocator. | |
Public Member Functions inherited from bslma::Allocator | |
~Allocator () BSLS_KEYWORD_OVERRIDE | |
template<class TYPE > | |
void | deleteObject (const TYPE *object) |
template<class TYPE > | |
void | deleteObjectRaw (const TYPE *object) |
void | deleteObject (bsl::nullptr_t) |
void | deleteObjectRaw (bsl::nullptr_t) |
Public Member Functions inherited from bsl::memory_resource | |
memory_resource () BSLS_KEYWORD_DEFAULT | |
Create this object. Has no effect other than to begin its lifetime. | |
memory_resource (const memory_resource &) BSLS_KEYWORD_DEFAULT | |
virtual | ~memory_resource () |
Destroy this object. Has no effect other than to end its lifetime. | |
memory_resource & | operator= (const memory_resource &) BSLS_KEYWORD_DEFAULT |
Return a modifiable reference to this object. | |
BSLS_ANNOTATION_NODISCARD void * | allocate (size_t bytes, size_t alignment=k_MAX_ALIGN) |
void | deallocate (void *p, size_t bytes, size_t alignment=k_MAX_ALIGN) |
bool | is_equal (const memory_resource &other) const BSLS_KEYWORD_NOEXCEPT |
Additional Inherited Members | |
Public Types inherited from bslma::Allocator | |
typedef std::size_t | size_type |
Static Public Member Functions inherited from bslma::Allocator | |
static void | throwBadAlloc () |
Protected Member Functions inherited from bslma::Allocator | |
void * | do_allocate (std::size_t bytes, std::size_t alignment) BSLS_KEYWORD_OVERRIDE |
void | do_deallocate (void *p, std::size_t bytes, std::size_t alignment) BSLS_KEYWORD_OVERRIDE |
bool | do_is_equal (const memory_resource &other) const BSLS_KEYWORD_NOEXCEPT BSLS_KEYWORD_OVERRIDE |
This class allows the caller to allocate memory directly from virtual memory, without going through the heap like malloc
or new
would. Note that the only way to free any memory allocated with this object is to destroy the object, at which point all memory it has allocated is freed. Thread-safe.
bdlma::HeapBypassAllocator::HeapBypassAllocator | ( | ) |
|
explicit |
Create an empty allocator object. Optionally specify replenishHint
as the minimum number of bytes to allocate at a time when the allocator's memory needs to grow. In a multi-threaded scenario, the programmer should ensure that replenishHint
is large enough so that multiple threads will rarely need to replenish at the same time in order to minimize contention.
bdlma::HeapBypassAllocator::~HeapBypassAllocator | ( | ) |
Destroy this object, releasing all managed buffers of memory that it has allocated.
|
inlinevirtual |
Allocate a buffer of memory having the specified size
(in bytes), and alignment defined by bsls::AlignmentUtil::BSLS_MAX_ALIGNMENT
, from virtual memory. If size
is 0, return a null pointer with no other effect. If this allocator cannot return the requested number of bytes, then it will throw a std::bad_alloc
exception in an exception-enabled build, or else will abort the program in a non- exception build. The behavior is undefined unless 0 <= size
.
Implements bslma::Allocator.
|
inlinevirtual |
Implements bslma::Allocator.