55#ifndef _QX_MODE_RELEASE
56#if _QX_USE_MEM_LEAK_DETECTION
58#ifndef _FIXED_MEM_POOL_H
59#define _FIXED_MEM_POOL_H
74#ifndef MEM_POOL_ALIGNMENT
75#define MEM_POOL_ALIGNMENT 4
101 static size_t _S_align(
size_t __size);
150 if (__block_ptr == NULL)
168 size_t __block_size =
_S_align(
sizeof(_Tp));
170 assert(__size > 0 && __block_size >=
sizeof(
void*));
176 while (--__size != 0)
178 char* __next_ = __block_ + __block_size;
179 *(
void**)__block_ = __next_;
182 *(
void**)__block_ = NULL;
267#define DECLARE_FIXED_MEM_POOL(_Cls) \
269 static void* operator new(size_t __size) \
271 assert(__size == sizeof(_Cls)); \
272 if (void* __ptr = fixed_mem_pool<_Cls>::allocate()) \
275 throw std::bad_alloc(); \
277 static void operator delete(void* __ptr) \
280 fixed_mem_pool<_Cls>::deallocate(__ptr); \
289#define DECLARE_FIXED_MEM_POOL__NOTHROW(_Cls) \
291 static void* operator new(size_t __size) throw() \
293 assert(__size == sizeof(_Cls)); \
294 return fixed_mem_pool<_Cls>::allocate(); \
296 static void operator delete(void* __ptr) \
299 fixed_mem_pool<_Cls>::deallocate(__ptr); \
314#define DECLARE_FIXED_MEM_POOL__THROW_NOCHECK(_Cls) \
316 static void* operator new(size_t __size) \
318 assert(__size == sizeof(_Cls)); \
319 return fixed_mem_pool<_Cls>::allocate(); \
321 static void operator delete(void* __ptr) \
324 fixed_mem_pool<_Cls>::deallocate(__ptr); \
static void * _S_mem_pool_ptr
static bool bad_alloc_handler()
static size_t _S_align(size_t __size)
static int get_alloc_count()
static bool initialize(size_t __size)
class_level_lock< fixed_mem_pool< _Tp > >::lock lock
static bool is_initialized()
static void deallocate(void *)
static void * _S_first_avail_ptr
static int deinitialize()
static void * alloc_sys(size_t __size)
static void dealloc_sys(void *__ptr)
#define MEM_POOL_ALIGNMENT
Root namespace for all QxOrm library features.