IRC_SERVER
By @hyunjunk (hyunjun2372@gmail.com)
Loading...
Searching...
No Matches
IRCCore::FlexibleFixedMemoryPool< T, MinNumDataPerChunk > Class Template Reference

A memory pool that can allocate flexible number of data. More...

#include <FlexibleFixedMemoryPool.hpp>

Classes

struct  Block
 

Public Member Functions

 FlexibleFixedMemoryPool ()
 
 ~FlexibleFixedMemoryPool ()
 
T * Allocate ()
 
void Deallocate (T *ptr)
 

Private Types

enum  { BLOCK_SIZE = sizeof(Block) }
 
enum  { CHUNK_MEMORY_PAGE_CAPACITY = (BLOCK_SIZE * MinNumDataPerChunk + PAGE_SIZE - 1) / PAGE_SIZE }
 

Private Attributes

std::vector< FixedMemoryPool< Block, CHUNK_MEMORY_PAGE_CAPACITY > * > mChunks
 
size_t mChunkCursor
 Index of the first chunk among the chunks with empty space.
 

Friends

class FixedMemoryPool< Block, CHUNK_MEMORY_PAGE_CAPACITY >
 

Detailed Description

template<typename T, size_t MinNumDataPerChunk = 64>
class IRCCore::FlexibleFixedMemoryPool< T, MinNumDataPerChunk >

A memory pool that can allocate flexible number of data.

Note
FlexibleFixedMemoryPool Implementated using chunking with FixedMemoryPool
Template Parameters
TType of data to allocate.
MinNumDataPerChunkMinimum number of data to allocate per chunk

Member Enumeration Documentation

◆ anonymous enum

template<typename T , size_t MinNumDataPerChunk = 64>
anonymous enum
private
Enumerator
BLOCK_SIZE 

◆ anonymous enum

template<typename T , size_t MinNumDataPerChunk = 64>
anonymous enum
private
Enumerator
CHUNK_MEMORY_PAGE_CAPACITY 

Constructor & Destructor Documentation

◆ FlexibleFixedMemoryPool()

template<typename T , size_t MinNumDataPerChunk = 64>
IRCCore::FlexibleFixedMemoryPool< T, MinNumDataPerChunk >::FlexibleFixedMemoryPool ( )
inline

◆ ~FlexibleFixedMemoryPool()

template<typename T , size_t MinNumDataPerChunk = 64>
IRCCore::FlexibleFixedMemoryPool< T, MinNumDataPerChunk >::~FlexibleFixedMemoryPool ( )
inline

Member Function Documentation

◆ Allocate()

template<typename T , size_t MinNumDataPerChunk = 64>
T * IRCCore::FlexibleFixedMemoryPool< T, MinNumDataPerChunk >::Allocate ( )
inline

◆ Deallocate()

template<typename T , size_t MinNumDataPerChunk = 64>
void IRCCore::FlexibleFixedMemoryPool< T, MinNumDataPerChunk >::Deallocate ( T * ptr)
inline

Friends And Related Symbol Documentation

◆ FixedMemoryPool< Block, CHUNK_MEMORY_PAGE_CAPACITY >

template<typename T , size_t MinNumDataPerChunk = 64>
friend class FixedMemoryPool< Block, CHUNK_MEMORY_PAGE_CAPACITY >
friend

Member Data Documentation

◆ mChunks

template<typename T , size_t MinNumDataPerChunk = 64>
std::vector< FixedMemoryPool< Block, CHUNK_MEMORY_PAGE_CAPACITY >* > IRCCore::FlexibleFixedMemoryPool< T, MinNumDataPerChunk >::mChunks
private

◆ mChunkCursor

template<typename T , size_t MinNumDataPerChunk = 64>
size_t IRCCore::FlexibleFixedMemoryPool< T, MinNumDataPerChunk >::mChunkCursor
private

Index of the first chunk among the chunks with empty space.


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