The standard C++17
include a new namespace pmr
including a set of classes grouped under the name of memory_resource
.
After a search on internet, I found very few vulgarized information about it, the direct consequence is this question:
What are the main ideas behind pmr
and especially pmr::memory_resource
?
Detailing a bit more the question, some of the question marks in my head are:
- What does it bring new, or what were the limitations it solve?
- What is the difference with
allocator
? - Does polymorphic mean it is possible to select runtime the
allocator
provided to a container constructor? (e.g. for testing purpose) - Does it helps for implementing memory pool, or other memory management schemes?
Context:
In the intend of creating a memory pool
allocator, I found information about this namespace. Reading names like pool_options
or polymorphic_allocator
raised my attention.
Related questions:
memory_resource
is what you derive from to achieve the polymorphic allocation functionality, as exposed through the allocator typepolymorphic_allocator
. β Amylumpool_options
,synchronized_pool_resource
,unsynchronized_pool_resource
monotonic_buffer_resource
,memory_resource class
.. and onlypolymorphic_allocator
is half answered. On the other hand, you closed because of duplicated question not duplicated answer (Remember that people do not know the answer and search by question) β Handal