Home ⌂Doc Index ◂Up ▴
Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::interface6::fixed_pool Class Reference

#include <memory_pool.h>

Inheritance diagram for tbb::interface6::fixed_pool:
Collaboration diagram for tbb::interface6::fixed_pool:

Public Member Functions

 fixed_pool (void *buf, size_t size)
 construct pool with underlying allocator More...
 
 ~fixed_pool ()
 destroy pool More...
 
- Public Member Functions inherited from tbb::interface6::internal::pool_base
void recycle ()
 Reset pool to reuse its memory (free all objects at once) More...
 
voidmalloc (size_t size)
 The "malloc" analogue to allocate block of memory of size bytes. More...
 
void free (void *ptr)
 The "free" analogue to discard a previously allocated piece of memory. More...
 
voidrealloc (void *ptr, size_t size)
 The "realloc" analogue complementing pool_malloc. More...
 

Static Private Member Functions

static voidallocate_request (intptr_t pool_id, size_t &bytes)
 

Private Attributes

voidmy_buffer
 
size_t my_size
 

Additional Inherited Members

- Protected Member Functions inherited from tbb::interface6::internal::pool_base
void destroy ()
 destroy pool - must be called in a child class More...
 
- Protected Attributes inherited from tbb::interface6::internal::pool_base
rml::MemoryPool * my_pool
 

Detailed Description

Definition at line 202 of file memory_pool.h.

Constructor & Destructor Documentation

◆ fixed_pool()

tbb::interface6::fixed_pool::fixed_pool ( void buf,
size_t  size 
)
inline

construct pool with underlying allocator

Definition at line 251 of file memory_pool.h.

251  : my_buffer(buf), my_size(size) {
252  if (!buf || !size)
253  // TODO: improve support for mode with exceptions disabled
254  tbb::internal::throw_exception(std::invalid_argument("Zero in parameter is invalid"));
255  rml::MemPoolPolicy args(allocate_request, 0, size, /*fixedPool=*/true);
256  rml::MemPoolError res = rml::pool_create_v1(intptr_t(this), &args, &my_pool);
257  if (res!=rml::POOL_OK)
258  tbb::internal::throw_exception(std::runtime_error("Can't create pool"));
259 }
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t size
static void * allocate_request(intptr_t pool_id, size_t &bytes)
Definition: memory_pool.h:260
void throw_exception(exception_id eid)
Versionless convenience wrapper for throw_exception_v4()

References allocate_request(), tbb::interface6::internal::pool_base::my_pool, size, and tbb::internal::throw_exception().

Here is the call graph for this function:

◆ ~fixed_pool()

tbb::interface6::fixed_pool::~fixed_pool ( )
inline

destroy pool

Definition at line 211 of file memory_pool.h.

211 { destroy(); }
void destroy()
destroy pool - must be called in a child class
Definition: memory_pool.h:67

References tbb::interface6::internal::pool_base::destroy().

Here is the call graph for this function:

Member Function Documentation

◆ allocate_request()

void * tbb::interface6::fixed_pool::allocate_request ( intptr_t  pool_id,
size_t &  bytes 
)
inlinestaticprivate

Definition at line 260 of file memory_pool.h.

260  {
261  fixed_pool &self = *reinterpret_cast<fixed_pool*>(pool_id);
262  __TBBMALLOC_ASSERT(0 != self.my_size, "The buffer must not be used twice.");
263  bytes = self.my_size;
264  self.my_size = 0; // remember that buffer has been used
265  return self.my_buffer;
266 }
fixed_pool(void *buf, size_t size)
construct pool with underlying allocator
Definition: memory_pool.h:251
#define __TBBMALLOC_ASSERT(a, b)
Definition: memory_pool.h:37

References __TBBMALLOC_ASSERT, and my_size.

Referenced by fixed_pool().

Here is the caller graph for this function:

Member Data Documentation

◆ my_buffer

void* tbb::interface6::fixed_pool::my_buffer
private

Definition at line 203 of file memory_pool.h.

◆ my_size

size_t tbb::interface6::fixed_pool::my_size
private

Definition at line 204 of file memory_pool.h.

Referenced by allocate_request().


The documentation for this class was generated from the following file:

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.