vsg 1.1.8
VulkanSceneGraph library
Loading...
Searching...
No Matches
vsg::IntrusiveAllocator Class Reference
Inheritance diagram for vsg::IntrusiveAllocator:
Collaboration diagram for vsg::IntrusiveAllocator:

Classes

struct  MemoryBlock
 
class  MemoryBlocks
 

Public Member Functions

 IntrusiveAllocator (size_t in_defaultAlignment=4)
 
 IntrusiveAllocator (std::unique_ptr< Allocator > in_nestedAllocator, size_t in_defaultAlignment=4)
 
void report (std::ostream &out) const override
 report stats about blocks of memory allocated.
 
void * allocate (std::size_t size, AllocatorAffinity allocatorAffinity=ALLOCATOR_AFFINITY_OBJECTS) override
 allocate from the pool of memory blocks, or allocate from a new memory block
 
bool deallocate (void *ptr, std::size_t size) override
 deallocate, returning data to pool.
 
bool validate () const
 
size_t deleteEmptyMemoryBlocks () override
 delete any MemoryBlock that are empty
 
size_t totalAvailableSize () const override
 return the total available size of allocated MemoryBlocks
 
size_t totalReservedSize () const override
 return the total reserved size of allocated MemoryBlocks
 
size_t totalMemorySize () const override
 return the total memory size of allocated MemoryBlocks
 
void setBlockSize (AllocatorAffinity allocatorAffinity, size_t blockSize) override
 
- Public Member Functions inherited from vsg::Allocator
 Allocator (size_t in_defaultAlignment=4)
 
 Allocator (std::unique_ptr< Allocator > in_nestedAllocator, size_t in_defaultAlignment=4)
 

Protected Attributes

std::vector< std::unique_ptr< MemoryBlocks > > allocatorMemoryBlocks
 
std::map< void *, std::shared_ptr< MemoryBlock > > memoryBlocks
 
std::map< void *, std::pair< size_t, size_t > > largeAllocations
 
- Protected Attributes inherited from vsg::Allocator
std::unique_ptr< AllocatornestedAllocator
 

Additional Inherited Members

- Static Public Member Functions inherited from vsg::Allocator
static std::unique_ptr< Allocator > & instance ()
 Allocator singleton.
 
- Public Attributes inherited from vsg::Allocator
AllocatorType allocatorType = ALLOCATOR_TYPE_VSG_ALLOCATOR
 
std::mutex mutex
 
size_t defaultAlignment = 4
 

Member Function Documentation

◆ allocate()

void * vsg::IntrusiveAllocator::allocate ( std::size_t size,
AllocatorAffinity allocatorAffinity = ALLOCATOR_AFFINITY_OBJECTS )
overridevirtual

allocate from the pool of memory blocks, or allocate from a new memory block

Implements vsg::Allocator.

◆ deallocate()

bool vsg::IntrusiveAllocator::deallocate ( void * ptr,
std::size_t size )
overridevirtual

deallocate, returning data to pool.

Implements vsg::Allocator.

◆ deleteEmptyMemoryBlocks()

size_t vsg::IntrusiveAllocator::deleteEmptyMemoryBlocks ( )
overridevirtual

delete any MemoryBlock that are empty

Implements vsg::Allocator.

◆ report()

void vsg::IntrusiveAllocator::report ( std::ostream & out) const
overridevirtual

report stats about blocks of memory allocated.

Implements vsg::Allocator.

◆ setBlockSize()

void vsg::IntrusiveAllocator::setBlockSize ( AllocatorAffinity allocatorAffinity,
size_t blockSize )
overridevirtual

Implements vsg::Allocator.

◆ totalAvailableSize()

size_t vsg::IntrusiveAllocator::totalAvailableSize ( ) const
overridevirtual

return the total available size of allocated MemoryBlocks

Implements vsg::Allocator.

◆ totalMemorySize()

size_t vsg::IntrusiveAllocator::totalMemorySize ( ) const
overridevirtual

return the total memory size of allocated MemoryBlocks

Implements vsg::Allocator.

◆ totalReservedSize()

size_t vsg::IntrusiveAllocator::totalReservedSize ( ) const
overridevirtual

return the total reserved size of allocated MemoryBlocks

Implements vsg::Allocator.


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