KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
Static Public Attributes | List of all members
Kratos::FixedSizeMemoryPool Class Reference

FixedSizeMemoryPool is the multi-thread manager of Kratos memory management. More...

#include <fixed_size_memory_pool.h>

Inheritance diagram for Kratos::FixedSizeMemoryPool:
Collaboration diagram for Kratos::FixedSizeMemoryPool:

Public Types

Type Definitions
using SizeType = Chunk::SizeType
 

Public Member Functions

Life Cycle
 FixedSizeMemoryPool ()=delete
 Default constructor is deleted. More...
 
 FixedSizeMemoryPool (FixedSizeMemoryPool const &rOther)=delete
 Copy constructor is deleted. More...
 
 FixedSizeMemoryPool (std::size_t BlockSizeInBytes, SizeType ChunkSize=DefaultChunkSize)
 The constructor to be called. More...
 
virtual ~FixedSizeMemoryPool ()
 Destructor. More...
 
Operators
FixedSizeMemoryPooloperator= (FixedSizeMemoryPool const &rOther)=delete
 Assignment operator is deleted. More...
 
Access
SizeType ChunkSize () const
 
Input and output
std::string Info () const
 Turn back information as a string. More...
 
void PrintInfo (std::ostream &rOStream) const
 Print information about this object. More...
 
void PrintData (std::ostream &rOStream) const
 Print object's data. More...
 
- Public Member Functions inherited from Kratos::LockObject
 LockObject () noexcept
 Default constructor. More...
 
 LockObject (LockObject const &rOther)=delete
 Copy constructor. More...
 
 ~LockObject () noexcept
 Destructor. More...
 
LockObjectoperator= (LockObject const &rOther)=delete
 Assignment operator. More...
 
void lock () const
 
void SetLock () const
 
void unlock () const
 
void UnSetLock () const
 
bool try_lock () const
 

Static Public Attributes

static constexpr SizeType DefaultChunkSize = 1024*1024
 

Operations

void * Allocate ()
 This function does not throw and returns zero if cannot allocate. More...
 
void Deallocate (void *pPointrerToRelease)
 
std::size_t MemoryUsed () const
 
std::size_t MemoryOverhead () const
 
std::size_t GetNumberOfAllocatedChunks () const
 

Detailed Description

FixedSizeMemoryPool is the multi-thread manager of Kratos memory management.

The memory management of Kratos is implemented based on the design given in Modern C++ Design by A. Alexandrescu. However a new layer is added over the ThreadFixedSizeMemoryPool in order to control the multi-thread creation and destruction of the chunks. This layer keeps ThreadFixedSizeMemoryPool for each thread and is in charge of calling their methods in a thread safe way and also feeds them with new chunk (or reusing the released ones)

Member Typedef Documentation

◆ SizeType

Constructor & Destructor Documentation

◆ FixedSizeMemoryPool() [1/3]

Kratos::FixedSizeMemoryPool::FixedSizeMemoryPool ( )
delete

Default constructor is deleted.

◆ FixedSizeMemoryPool() [2/3]

Kratos::FixedSizeMemoryPool::FixedSizeMemoryPool ( FixedSizeMemoryPool const &  rOther)
delete

Copy constructor is deleted.

◆ FixedSizeMemoryPool() [3/3]

Kratos::FixedSizeMemoryPool::FixedSizeMemoryPool ( std::size_t  BlockSizeInBytes,
SizeType  ChunkSize = DefaultChunkSize 
)
inline

The constructor to be called.

◆ ~FixedSizeMemoryPool()

virtual Kratos::FixedSizeMemoryPool::~FixedSizeMemoryPool ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ Allocate()

void* Kratos::FixedSizeMemoryPool::Allocate ( )
inline

This function does not throw and returns zero if cannot allocate.

◆ ChunkSize()

SizeType Kratos::FixedSizeMemoryPool::ChunkSize ( ) const
inline

◆ Deallocate()

void Kratos::FixedSizeMemoryPool::Deallocate ( void *  pPointrerToRelease)
inline

◆ GetNumberOfAllocatedChunks()

std::size_t Kratos::FixedSizeMemoryPool::GetNumberOfAllocatedChunks ( ) const
inline

◆ Info()

std::string Kratos::FixedSizeMemoryPool::Info ( ) const
inline

Turn back information as a string.

◆ MemoryOverhead()

std::size_t Kratos::FixedSizeMemoryPool::MemoryOverhead ( ) const
inline

◆ MemoryUsed()

std::size_t Kratos::FixedSizeMemoryPool::MemoryUsed ( ) const
inline

◆ operator=()

FixedSizeMemoryPool& Kratos::FixedSizeMemoryPool::operator= ( FixedSizeMemoryPool const &  rOther)
delete

Assignment operator is deleted.

◆ PrintData()

void Kratos::FixedSizeMemoryPool::PrintData ( std::ostream &  rOStream) const
inline

Print object's data.

◆ PrintInfo()

void Kratos::FixedSizeMemoryPool::PrintInfo ( std::ostream &  rOStream) const
inline

Print information about this object.

Member Data Documentation

◆ DefaultChunkSize

constexpr SizeType Kratos::FixedSizeMemoryPool::DefaultChunkSize = 1024*1024
staticconstexpr

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