Memory manager allowing to create and delete arrays of objects in a memory efficient way.
More...
|
| CoreArrayPool (const unsigned int &array_size, const unsigned int &chunk_size=128) |
| Constructor.
|
|
void | init (const unsigned int &array_size, const unsigned int &chunk_size=128) |
| Init the pool and clear any allocated memory.
|
|
T * | alloc_array () |
| Gets the pointer of an available array. Do not call objects constructor.
|
|
void | free_array (T *array) |
| Frees the array with specified pointer. Do not call objects destructor.
|
|
T * | new_array () |
| Gets the pointer of an available array. Call objects constructor.
|
|
void | delete_array (T *array) |
| Frees the array with specified pointer. Call objects destructor.
|
|
unsigned int | get_array_size () const |
|
unsigned int | get_allocated_array_count () const |
|
unsigned int | get_used_array_count () const |
|
size_t | get_memory_size () const |
|
template<class T>
class CoreArrayPool< T >
Memory manager allowing to create and delete arrays of objects in a memory efficient way.
Constructor.
- Parameters
-
[in] | array_size | size of arrays to allocate |
[in] | chunk_size | number of arrays allocated at once |
template<class T >
void CoreArrayPool< T >::init |
( |
const unsigned int & |
array_size, |
|
|
const unsigned int & |
chunk_size = 128 |
|
) |
| |
Init the pool and clear any allocated memory.
- Parameters
-
[in] | array_size | number of objects per allocated array |
[in] | chunk_size | number of arrays allocated at once |