1.. _scalable_memory_pools_reference: 2 3Scalable Memory Pools 4===================== 5 6.. note:: 7 To enable this feature, set the ``TBB_PREVIEW_MEMORY_POOL`` macro to 1. 8 9Memory pools allocate and free memory from a specified region or an underlying allocator using 10thread-safe, scalable operations. The following table summarizes the Memory Pool named requirement. 11Here, ``P`` represents an instance of the memory pool class. 12 13.. container:: tablenoborder 14 15 .. list-table:: 16 :header-rows: 1 17 18 * - Pseudo-Signature 19 - Semantics 20 * - \ ``~P() throw();`` 21 - Destructor. Frees all the allocated memory. 22 * - \ ``void P::recycle();`` 23 - Frees all the allocated memory. 24 * - \ ``void* P::malloc(size_t n);`` 25 - Returns a pointer to ``n`` bytes allocated from the memory pool. 26 * - \ ``void P::free(void* ptr);`` 27 - Frees the memory object specified via ``ptr`` pointer. 28 * - \ ``void* P::realloc(void* ptr, size_t n);`` 29 - Reallocates the memory object pointed by ``ptr`` to ``n`` bytes. 30 31.. container:: section 32 33 .. rubric:: Model Types 34 :class: sectiontitle 35 36 The ``memory_pool`` template class and the ``fixed_pool`` class meet the Memory Pool named requirement. 37 38.. toctree:: 39 :titlesonly: 40 41 scalable_memory_pools/memory_pool_cls 42 scalable_memory_pools/fixed_pool_cls 43 scalable_memory_pools/memory_pool_allocator_cls 44