2 #include "util/mutex.h" 3 #include <boost/pool/object_pool.hpp> 8 template <
typename UserAllocator = boost::default_user_allocator_new_delete,
typename Mutex=ParaEngine::mutex>
17 template <
typename UserAllocator,
typename Mutex>
21 typedef typename UserAllocator::size_type size_type;
22 typedef typename UserAllocator::difference_type difference_type;
24 typedef typename boost::pool<UserAllocator> pool_type;
29 const size_type nnext_size = 32)
30 :pool_type(nrequested_size, nnext_size) { }
36 return pool_type::malloc();
38 void free(
void *
const chunk)
41 return pool_type::free(chunk);
44 static mutex_type s_mutex;
46 template <
typename UserAllocator,
typename Mutex>
62 static void*
operator new(
size_t size) {
63 return s_memPool.malloc();
66 static void operator delete(
void *p) {
93 static void*
operator new(
size_t size) {
94 return s_memPool.malloc();
97 static void operator delete(
void *p) {
102 static boost::pool<> s_memPool;
different physics engine has different winding order.
Definition: EventBinding.h:32
simple scoped lock function
Definition: mutex.h:12
if one wants to create and delete many objects of the same type per frame, derive your class from Poo...
Definition: PoolBase.h:60
cross platform mutex
Definition: Mutex.hpp:88
if one wants to create and delete many objects of the same type per frame, derive your class from Poo...
Definition: PoolBase.h:91
this is a thread safe version of boost::pool.
Definition: PoolBase.h:9