Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
AeonGames::MemoryPool Class Reference

This is a modification of the implementation in the "Fast Efficient Fixed-Size Memory Pool" paper by Ben Kenwright. More...

#include <aeongames/MemoryPool.hpp>

Collaboration diagram for AeonGames::MemoryPool:
Collaboration graph

Public Member Functions

DLL MemoryPool (size_t sizeOfEachBlock, size_t numOfBlocks)
 Construct a memory pool.
DLL void * Allocate ()
 Allocate a block from the pool.
DLL void DeAllocate (void *p)
 Return a block to the pool.

Detailed Description

This is a modification of the implementation in the "Fast Efficient Fixed-Size Memory Pool" paper by Ben Kenwright.

Definition at line 53 of file MemoryPool.hpp.

Constructor & Destructor Documentation

◆ MemoryPool()

AeonGames::MemoryPool::MemoryPool ( size_t sizeOfEachBlock,
size_t numOfBlocks )

Construct a memory pool.

Parameters
sizeOfEachBlockSize of each memory block in bytes.
numOfBlocksNumber of blocks to pre-allocate.

Definition at line 19 of file MemoryPool.cpp.

Member Function Documentation

◆ Allocate()

void * AeonGames::MemoryPool::Allocate ( )

Allocate a block from the pool.

Returns
Pointer to the allocated block.

Definition at line 39 of file MemoryPool.cpp.

◆ DeAllocate()

void AeonGames::MemoryPool::DeAllocate ( void * p)

Return a block to the pool.

Parameters
pPointer to the block to deallocate.

Definition at line 64 of file MemoryPool.cpp.


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