vsg  1.1.0
VulkanSceneGraph library
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
vsg::Allocator Class Reference

#include <Allocator.h>


struct  MemoryBlock
struct  MemoryBlocks

Public Member Functions

 Allocator (std::unique_ptr< Allocator > in_nestedAllocator={})
virtual void * allocate (std::size_t size, AllocatorAffinity allocatorAffinity=ALLOCATOR_AFFINITY_OBJECTS)
 allocate from the pool of memory blocks, or allocate from a new memory block
virtual bool deallocate (void *ptr, std::size_t size)
 deallocate, returning data to pool.
virtual size_t deleteEmptyMemoryBlocks ()
 delete any MemoryBlock that are empty
virtual size_t totalAvailableSize () const
 return the total available size of allocated MemoryBlocks
virtual size_t totalReservedSize () const
 return the total reserved size of allocated MemoryBlocks
virtual size_t totalMemorySize () const
 return the total memory size of allocated MemoryBlocks
virtual void report (std::ostream &out) const
 report stats about blocks of memory allocated.
void setMemoryTracking (int mt)
 set the MemoryTracking member of the vsg::Allocator and all the MemoryBlocks that it manages.
MemoryBlocksgetMemoryBlocks (AllocatorAffinity allocatorAffinity)
MemoryBlocksgetOrCreateMemoryBlocks (AllocatorAffinity allocatorAffinity, const std::string &name, size_t blockSize)
void setBlockSize (AllocatorAffinity allocatorAffinity, size_t blockSize)

Static Public Member Functions

static std::unique_ptr< Allocator > & instance ()
 Allocator singleton.

Public Attributes

AllocatorType allocatorType = ALLOCATOR_TYPE_VSG_ALLOCATOR
AllocatorType memoryBlocksAllocatorType = ALLOCATOR_TYPE_NEW_DELETE
int memoryTracking = MEMORY_TRACKING_DEFAULT
std::mutex mutex
double allocationTime = 0.0
double deallocationTime = 0.0

Protected Attributes

std::unique_ptr< AllocatornestedAllocator
std::vector< std::unique_ptr< MemoryBlocks > > allocatorMemoryBlocks

Detailed Description

extensible Allocator that handles allocation and deallocation of scene graph CPU memory,

The documentation for this class was generated from the following file: