Castor3D 0.16.0
Multiplatform 3D engine
Public Member Functions | List of all members
castor::BuddyAllocatorT< Traits > Class Template Reference

Buddy allocator implementation. More...

#include <BuddyAllocator.hpp>

Inheritance diagram for castor::BuddyAllocatorT< Traits >:
Inheritance graph
[legend]
Collaboration diagram for castor::BuddyAllocatorT< Traits >:
Collaboration graph
[legend]

Public Member Functions

 BuddyAllocatorT (uint32_t numLevels, uint32_t minBlockSize)
 Constructor.
 
bool hasAvailable (size_t size) const
 
PointerType allocate (size_t size)
 Allocates memory.
 
void deallocate (PointerType pointer)
 Deallocates memory.
 
size_t getTotalSize () const
 The pool total size.
 
size_t getAlignSize () const
 

Detailed Description

template<typename Traits>
class castor::BuddyAllocatorT< Traits >

Buddy allocator implementation.

Constructor & Destructor Documentation

◆ BuddyAllocatorT()

template<typename Traits >
castor::BuddyAllocatorT< Traits >::BuddyAllocatorT ( uint32_t numLevels,
uint32_t minBlockSize )

Constructor.

Parameters
[in]numLevelsThe allocator maximum tree size.
[in]minBlockSizeThe minimum size for a block.

Member Function Documentation

◆ allocate()

template<typename Traits >
PointerType castor::BuddyAllocatorT< Traits >::allocate ( size_t size)

Allocates memory.

Parameters
[in]sizeThe requested memory size.
Returns
The memory chunk.

◆ deallocate()

template<typename Traits >
void castor::BuddyAllocatorT< Traits >::deallocate ( PointerType pointer)

Deallocates memory.

Parameters
[in]pointerThe memory chunk.

◆ getAlignSize()

template<typename Traits >
size_t castor::BuddyAllocatorT< Traits >::getAlignSize ( ) const
inline

◆ getTotalSize()

template<typename Traits >
size_t castor::BuddyAllocatorT< Traits >::getTotalSize ( ) const

The pool total size.

◆ hasAvailable()

template<typename Traits >
bool castor::BuddyAllocatorT< Traits >::hasAvailable ( size_t size) const
Parameters
[in]sizeThe requested memory size.
Returns
true if there is enough remaining memory for given size.

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