Boost logo

Boost :

Subject: [boost] [container] Implemented Polymorphic Memory Resources
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2015-09-07 16:23:32


Hi to all,

In case anyone is interested, I just committed to the develop branch the
implementation of the proposal "N3916 Polymorphic Memory Resources - r2"
that was included in the TS "C++ Extensions for Library Fundamentals".
The library continues to support C++03 compilers.

It basically introduces in namespace boost::container::pmr and the path
boost/container/pmr/:

- memory_resource
- synchronized_pool_resource
- unsynchronized_pool_resource
- monotonic_buffer_resource
- polymorphic_allocator
- resource_adaptor
- new_delete_resource / null_memory_resource / get_default_resource /
set_default_resource
- Aliases for all containers, using the polymorphic_allocator.

As default resource, new_delete_resource and null_memory_resource are
required to be globals, they are implemented in the separately compiled
boost.container library that was used to implement the DLMalloc-based
extended allocator.

It seems that many users dislike building Boost libraries, but I felt
this was the correct way to implement it. We could change or make it
optionally header-only if there is demand. To avoid dependencies to some
users, I made sure that memory_resource and resource_adaptor, which
don't depend on the global default memory resource, can be used without
linking the library.

Some logic was refactored from scoped_allocator_adaptor to avoid
repeating the complicated template and preprocessor machinery in the
polymorphic_allocator. I hope this does not cause any problem to scoped
allocator users.

Any suggestion or bug report is welcome. Best,

Ion


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk