SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DataStructures::MemoryPool< MemoryBlockType > Class Template Reference

`#include <slikenet/DS_MemoryPool.h>`

Inheritance diagram for DataStructures::MemoryPool< MemoryBlockType >:

## Classes

struct | MemoryWithPage
struct | Page

## Public Member Functions

| MemoryPool ()
| ~MemoryPool ()
void | SetPageSize (int size)
MemoryBlockType * | Allocate (const char *file, unsigned int line)
void | Release (MemoryBlockType *m, const char *file, unsigned int line)
void | Clear (const char *file, unsigned int line)
int | GetAvailablePagesSize (void) const
int | GetUnavailablePagesSize (void) const
int | GetMemoryPoolPageSize (void) const

## Protected Member Functions

int | BlocksPerPage (void) const
void | AllocateFirst (void)
bool | InitPage (Page *page, Page *prev, const char *file, unsigned int line)

## Protected Attributes

Page * | availablePages
Page * | unavailablePages
int | availablePagesSize
int | unavailablePagesSize
int | memoryPoolPageSize

## Detailed Description

### template<class MemoryBlockType>
class DataStructures::MemoryPool< MemoryBlockType >

Very fast memory pool for allocating and deallocating structures that don't have constructors or destructors. Contains a list of pages, each of which has an array of the user structures

Definition at line 42 of file DS_MemoryPool.h.

## Class Documentation

struct DataStructures::MemoryPool::MemoryWithPage

### template<class MemoryBlockType>
struct DataStructures::MemoryPool< MemoryBlockType >::MemoryWithPage

Definition at line 46 of file DS_MemoryPool.h.

Class Members
Page * | parentPage |
MemoryBlockType | userMemory |

struct DataStructures::MemoryPool::Page

### template<class MemoryBlockType>
struct DataStructures::MemoryPool< MemoryBlockType >::Page

Definition at line 51 of file DS_MemoryPool.h.

Class Members
MemoryWithPage ** | availableStack |
int | availableStackSize |
MemoryWithPage * | block |
Page * | next |
Page * | prev |

## Constructor & Destructor Documentation

template<class MemoryBlockType >

DataStructures::MemoryPool< MemoryBlockType >::MemoryPool | ( |  | ) |

Definition at line 83 of file DS_MemoryPool.h.

template<class MemoryBlockType >

DataStructures::MemoryPool< MemoryBlockType >::~MemoryPool | ( |  | ) |

Definition at line 93 of file DS_MemoryPool.h.

References _FILE_AND_LINE_.

## Member Function Documentation

template<class MemoryBlockType >

MemoryBlockType * DataStructures::MemoryPool< MemoryBlockType >::Allocate | ( | const char * | file,
|  | unsigned int | line
| ) |  |

Definition at line 107 of file DS_MemoryPool.h.

References DataStructures::MemoryPool< MemoryBlockType >::Page::availableStack, DataStructures::MemoryPool< MemoryBlockType >::Page::availableStackSize, DataStructures::MemoryPool< MemoryBlockType >::Page::next, DataStructures::Page< KeyType, DataType, order >::next, DataStructures::MemoryPool< MemoryBlockType >::Page::prev, RakAssert, and rakMalloc_Ex.

Referenced by DataStructures::BytePool::Allocate(), SLNet::VariableDeltaSerializer::AllocChangedVariablesList(), SLNet::RakPeer::AllocPacket(), and SLNet::RakPeer::ReferenceRemoteSystem().

template<class MemoryBlockType>

void DataStructures::MemoryPool< MemoryBlockType >::AllocateFirst | ( | void |  | ) |

protected

template<class MemoryBlockType >

int DataStructures::MemoryPool< MemoryBlockType >::BlocksPerPage | ( | void |  | ) | const

protected

Definition at line 271 of file DS_MemoryPool.h.

template<class MemoryBlockType >

void DataStructures::MemoryPool< MemoryBlockType >::Clear | ( | const char * | file,
|  | unsigned int | line
| ) |  |

Definition at line 221 of file DS_MemoryPool.h.

References DataStructures::MemoryPool< MemoryBlockType >::Page::availableStack, DataStructures::MemoryPool< MemoryBlockType >::Page::block, DataStructures::MemoryPool< MemoryBlockType >::Page::next, and rakFree_Ex.

Referenced by DataStructures::BytePool::Clear(), SLNet::RakPeer::ClearRemoteSystemLookup(), and SLNet::RakPeer::Shutdown().

template<class MemoryBlockType>

int DataStructures::MemoryPool< MemoryBlockType >::GetAvailablePagesSize | ( | void |  | ) | const

inline

Definition at line 66 of file DS_MemoryPool.h.

template<class MemoryBlockType>

int DataStructures::MemoryPool< MemoryBlockType >::GetMemoryPoolPageSize | ( | void |  | ) | const

inline

Definition at line 68 of file DS_MemoryPool.h.

template<class MemoryBlockType>

int DataStructures::MemoryPool< MemoryBlockType >::GetUnavailablePagesSize | ( | void |  | ) | const

inline

Definition at line 67 of file DS_MemoryPool.h.

template<class MemoryBlockType >

bool DataStructures::MemoryPool< MemoryBlockType >::InitPage | ( | Page * | page,
|  | Page * | prev,
|  | const char * | file,
|  | unsigned int | line
| ) |  |

protected

Definition at line 276 of file DS_MemoryPool.h.

References DataStructures::MemoryPool< MemoryBlockType >::Page::availableStack, DataStructures::MemoryPool< MemoryBlockType >::Page::availableStackSize, DataStructures::MemoryPool< MemoryBlockType >::Page::block, DataStructures::MemoryPool< MemoryBlockType >::Page::next, DataStructures::MemoryPool< MemoryBlockType >::MemoryWithPage::parentPage, DataStructures::MemoryPool< MemoryBlockType >::Page::prev, rakFree_Ex, and rakMalloc_Ex.

template<class MemoryBlockType>

void DataStructures::MemoryPool< MemoryBlockType >::Release | ( | MemoryBlockType * | m,
|  | const char * | file,
|  | unsigned int | line
| ) |  |

Definition at line 159 of file DS_MemoryPool.h.

References DataStructures::MemoryPool< MemoryBlockType >::Page::availableStack, DataStructures::MemoryPool< MemoryBlockType >::Page::availableStackSize, DataStructures::MemoryPool< MemoryBlockType >::Page::block, DS_MEMORY_POOL_MAX_FREE_PAGES, DataStructures::MemoryPool< MemoryBlockType >::Page::next, DataStructures::Page< KeyType, DataType, order >::next, DataStructures::MemoryPool< MemoryBlockType >::MemoryWithPage::parentPage, DataStructures::MemoryPool< MemoryBlockType >::Page::prev, RakAssert, and rakFree_Ex.

Referenced by SLNet::RakPeer::DeallocatePacket(), SLNet::RakPeer::DereferenceRemoteSystem(), SLNet::VariableDeltaSerializer::FreeChangedVariablesList(), and DataStructures::BytePool::Release().

template<class MemoryBlockType >

void DataStructures::MemoryPool< MemoryBlockType >::SetPageSize | ( | int | size | ) |

Definition at line 101 of file DS_MemoryPool.h.

Referenced by DataStructures::BytePool::BytePool(), and DataStructures::BytePool::SetPageSize().

## Member Data Documentation

template<class MemoryBlockType>

Page* DataStructures::MemoryPool< MemoryBlockType >::availablePages

protected

Definition at line 77 of file DS_MemoryPool.h.

template<class MemoryBlockType>

int DataStructures::MemoryPool< MemoryBlockType >::availablePagesSize

protected

Definition at line 78 of file DS_MemoryPool.h.

template<class MemoryBlockType>

int DataStructures::MemoryPool< MemoryBlockType >::memoryPoolPageSize

protected

Definition at line 79 of file DS_MemoryPool.h.

template<class MemoryBlockType>

Page * DataStructures::MemoryPool< MemoryBlockType >::unavailablePages

protected

Definition at line 77 of file DS_MemoryPool.h.

template<class MemoryBlockType>

int DataStructures::MemoryPool< MemoryBlockType >::unavailablePagesSize

protected

Definition at line 78 of file DS_MemoryPool.h.

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

- Source/include/slikenet/DS_MemoryPool.h