pmt::pmt_pool
pmt/pmt_pool.h
pmt::pmt_pool::item
std::unique_lock< std::mutex > using pmt::pmt_pool::scoped_lock = std::unique_lock<std::mutex> scoped_lock pmt::pmt_pool::scoped_lock
std::mutex std::mutex pmt::pmt_pool::d_mutex d_mutex pmt::pmt_pool::d_mutex
std::condition_variable std::condition_variable pmt::pmt_pool::d_cond d_cond pmt::pmt_pool::d_cond
size_t size_t pmt::pmt_pool::d_itemsize d_itemsize pmt::pmt_pool::d_itemsize
size_t size_t pmt::pmt_pool::d_alignment d_alignment pmt::pmt_pool::d_alignment
size_t size_t pmt::pmt_pool::d_allocation_size d_allocation_size pmt::pmt_pool::d_allocation_size
size_t size_t pmt::pmt_pool::d_max_items d_max_items pmt::pmt_pool::d_max_items
size_t size_t pmt::pmt_pool::d_n_items d_n_items pmt::pmt_pool::d_n_items
item * item* pmt::pmt_pool::d_freelist d_freelist pmt::pmt_pool::d_freelist
std::vector< char * > std::vector<char*> pmt::pmt_pool::d_allocations d_allocations pmt::pmt_pool::d_allocations
pmt::pmt_pool::pmt_pool
(size_t itemsize, size_t alignment=16, size_t allocation_size=4096, size_t max_items=0)
pmt_pool
pmt::pmt_pool::pmt_pool
size_t itemsize
size_t alignment 16
size_t allocation_size 4096
size_t max_items 0

itemsize

size in bytes of the items to be allocated.

alignment

alignment in bytes of all objects to be allocated (must be power-of-2).

allocation_size

number of bytes to allocate at a time from the underlying allocator.

max_items

is the maximum number of items to allocate. If this number is exceeded, the allocate blocks. 0 implies no limit.

pmt::pmt_pool::~pmt_pool
()
~pmt_pool
pmt::pmt_pool::~pmt_pool
void * void * pmt::pmt_pool::malloc () malloc pmt::pmt_pool::malloc
void void pmt::pmt_pool::free (void *p) free pmt::pmt_pool::free void * p

very simple thread-safe fixed-size allocation pool

FIXME may want to go to global allocation with per-thread free list. This would eliminate virtually all lock contention.

- pmt::pmt_pool
  d_alignment
- pmt::pmt_pool
  d_allocation_size
- pmt::pmt_pool
  d_allocations
- pmt::pmt_pool
  d_cond
- pmt::pmt_pool
  d_freelist
- pmt::pmt_pool
  d_itemsize
- pmt::pmt_pool
  d_max_items
- pmt::pmt_pool
  d_mutex
- pmt::pmt_pool
  d_n_items
- pmt::pmt_pool
  free
- pmt::pmt_pool
  malloc
- pmt::pmt_pool
  pmt_pool
- pmt::pmt_pool
  scoped_lock
- pmt::pmt_pool
  ~pmt_pool