![]() |
QxOrm 1.4.9
C++ Object Relational Mapping library
|
#include <static_mem_pool.h>
Public Member Functions | |
void * | allocate () |
void | deallocate (void *__ptr) |
virtual void | recycle () |
![]() | |
virtual | ~mem_pool_base () |
Static Public Member Functions | |
static static_mem_pool & | instance () |
static static_mem_pool & | instance_known () |
![]() | |
static void * | alloc_sys (size_t __size) |
static void | dealloc_sys (void *__ptr) |
Private Types | |
typedef class_level_lock< static_mem_pool< _Sz, _Gid >,(_Gid< 0)>::lock | lock |
Private Member Functions | |
static_mem_pool () | |
~static_mem_pool () | |
static_mem_pool (const static_mem_pool &) | |
const static_mem_pool & | operator= (const static_mem_pool &) |
Static Private Member Functions | |
static size_t | _S_align (size_t __size) |
static void * | _S_alloc_sys (size_t __size) |
static static_mem_pool * | _S_create_instance () |
Static Private Attributes | |
static bool | _S_destroyed = false |
static static_mem_pool * | _S_instance_p = _S_create_instance() |
static mem_pool_base::_Block_list * | _S_memory_block_p = NULL |
Singleton class template to manage the allocation/deallocation of memory blocks of one specific size.
_Sz | size of elements in the static_mem_pool |
_Gid | group id of a static_mem_pool: if it is negative, simultaneous accesses to this static_mem_pool will be protected from each other; otherwise no protection is given |
Definition at line 124 of file static_mem_pool.h.
|
private |
Definition at line 127 of file static_mem_pool.h.
|
inlineprivate |
Definition at line 195 of file static_mem_pool.h.
|
inlineprivate |
Definition at line 200 of file static_mem_pool.h.
|
private |
|
inlinestaticprivate |
Definition at line 221 of file static_mem_pool.h.
|
staticprivate |
Definition at line 276 of file static_mem_pool.h.
|
staticprivate |
Definition at line 289 of file static_mem_pool.h.
|
inline |
Allocates memory and returns its pointer. The template will try to get it from the memory pool first, and request memory from the system if there is no free memory in the pool.
NULL
otherwise Definition at line 166 of file static_mem_pool.h.
|
inline |
Deallocates memory by putting the memory block into the pool.
__ptr | pointer to memory to be deallocated |
Definition at line 184 of file static_mem_pool.h.
|
inlinestatic |
Gets the instance of the static memory pool. It will create the instance if it does not already exist. Generally this function is now not needed.
Definition at line 137 of file static_mem_pool.h.
|
inlinestatic |
Gets the known instance of the static memory pool. The instance must already exist. Generally the static initializer of the template guarantees it.
Definition at line 153 of file static_mem_pool.h.
|
private |
|
virtual |
Recycles half of the free memory blocks in the memory pool to the system. It is called when a memory request to the system (in other instances of the static memory pool) fails.
Implements qx::memory::mem_pool_base.
Definition at line 250 of file static_mem_pool.h.
|
staticprivate |
Definition at line 228 of file static_mem_pool.h.
|
staticprivate |
Definition at line 229 of file static_mem_pool.h.
|
staticprivate |
Definition at line 230 of file static_mem_pool.h.