33#ifndef DART_COMMON_MEMORYALLOCATORDEBUGGER_HPP_
34#define DART_COMMON_MEMORYALLOCATORDEBUGGER_HPP_
38#include <unordered_map>
49 template <
typename... Args>
59 [[nodiscard]]
const std::string&
getType()
const override;
62 [[nodiscard]]
void*
allocate(
size_t bytes)
noexcept override;
65 void deallocate(
void* pointer,
size_t bytes)
override;
68 [[nodiscard]]
bool isEmpty()
const;
71 [[nodiscard]]
bool hasAllocated(
void* pointer,
size_t size)
const;
80 void print(std::ostream& os = std::cout,
int indent = 0)
const override;
Definition MemoryAllocatorDebugger.hpp:46
size_t mSize
Definition MemoryAllocatorDebugger.hpp:85
void * allocate(size_t bytes) noexcept override
Allocates size bytes of uninitialized storage.
Definition MemoryAllocatorDebugger-impl.hpp:98
size_t mPeak
Definition MemoryAllocatorDebugger.hpp:87
bool hasAllocated(void *pointer, size_t size) const
Returns true if a pointer is allocated by the internal allocator.
Definition MemoryAllocatorDebugger-impl.hpp:155
void deallocate(void *pointer, size_t bytes) override
Deallocates the storage referenced by the pointer p, which must be a pointer obtained by an earlier c...
Definition MemoryAllocatorDebugger-impl.hpp:115
std::mutex mMutex
Definition MemoryAllocatorDebugger.hpp:91
std::unordered_map< void *, size_t > mMapPointerToSize
Definition MemoryAllocatorDebugger.hpp:89
const std::string & getType() const override
Returns type string.
Definition MemoryAllocatorDebugger-impl.hpp:91
bool isEmpty() const
Returns true if there is no memory allocated by the internal allocator.
Definition MemoryAllocatorDebugger-impl.hpp:147
const T & getInternalAllocator() const
Returns the internal allocator.
Definition MemoryAllocatorDebugger-impl.hpp:176
~MemoryAllocatorDebugger()
Destructor.
Definition MemoryAllocatorDebugger-impl.hpp:53
static const std::string & getStaticType()
Returns type string.
Definition MemoryAllocatorDebugger-impl.hpp:82
void print(std::ostream &os=std::cout, int indent=0) const override
Prints state of the memory allocator.
Definition MemoryAllocatorDebugger-impl.hpp:190
T mInternalAllocator
Definition MemoryAllocatorDebugger.hpp:83
Base class for std::allocator compatible allocators.
Definition MemoryAllocator.hpp:46