An allocator backed by malloc and free system calls. More...
#include <mallocator.hpp>
Public Member Functions | |
memory_block | allocate (std::size_t size) |
Allocates a memory_block using malloc. More... | |
void | deallocate (memory_block &block) |
Deallocates memory block using free. More... | |
bool | owns (memory_block &block) |
Checks if the block has been allocated with this allocator. More... | |
Static Public Member Functions | |
static mallocator * | self_allocate () |
Allocates an instance of mallocator on the heap. More... | |
An allocator backed by malloc and free system calls.
Definition at line 14 of file mallocator.hpp.
|
inline |
Allocates a memory_block using malloc.
size |
Definition at line 27 of file mallocator.ipp.
|
inline |
Deallocates memory block using free.
block | A memory_block to deallocate. |
Definition at line 36 of file mallocator.ipp.
|
inline |
Checks if the block has been allocated with this allocator.
block | The block to check. |
Definition at line 42 of file mallocator.ipp.
|
inlinestatic |
Allocates an instance of mallocator on the heap.
In certain situations it's required to allocate an instance of this allocator on the heap. This method is used to do so.
Definition at line 16 of file mallocator.ipp.