6 #ifndef PIVX_SUPPORT_ALLOCATORS_POOLED_SECURE_H
7 #define PIVX_SUPPORT_ALLOCATORS_POOLED_SECURE_H
15 #include <boost/pool/pool_alloc.hpp>
24 typedef std::allocator<T>
base;
35 pool(nrequested_size, nnext_size, nmax_size){}
40 size_t chunks = (n *
sizeof(
T) +
pool.get_requested_size() - 1) /
pool.get_requested_size();
41 return static_cast<T*
>(
pool.ordered_malloc(chunks));
50 size_t chunks = (n *
sizeof(
T) +
pool.get_requested_size() - 1) /
pool.get_requested_size();
52 pool.ordered_free(p, chunks);
65 static void free(
char*
const block)
71 boost::pool<internal_secure_allocator>
pool;
void free(void *ptr)
Free a previously allocated chunk of memory.
void * alloc(size_t size)
Allocate size bytes from this arena.
static LockedPoolManager & Instance()
Return the current instance, or create it once.
void memory_cleanse(void *ptr, size_t len)
#define T(expected, seed, data)
static void free(char *const block)
static char * malloc(const size_type bytes)
std::ptrdiff_t difference_type
base::const_reference const_reference
void deallocate(T *p, std::size_t n)
base::size_type size_type
base::value_type value_type
base::reference reference
T * allocate(std::size_t n, const void *hint=0)
boost::pool< internal_secure_allocator > pool
pooled_secure_allocator(const size_type nrequested_size=32, const size_type nnext_size=32, const size_type nmax_size=0)
base::const_pointer const_pointer
base::difference_type difference_type
~pooled_secure_allocator()